Skip to content

Unhelpful error message when using incorrect directive key (WAS: "Expected '=' after directive key" but '=' is present (SC1072, SC1073, SC1134)) #3425

@shelvacu

Description

@shelvacu

When specifying disable=foo (or any invalid value), shellcheck says Expected '=' after directive key which is very confusing since '=' is present and after the directive key.

For bugs with existing features

  • Rule Id (if any, e.g. SC1000): SC1072, SC1073, SC1134 (only kindof relevant)
  • My shellcheck version (shellcheck --version or "online"): Tried on both 0.11.0 and master as of 2026-03-22 (cd41f79)
  • The rules' wiki pages do not already cover this
  • I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit

Here's a snippet that shows the problem & Here's what shellcheck currently says:

When in # shellcheck directive:

$ shellcheck -s sh <(echo '# shellcheck disable=foo')

In /dev/fd/63 line 1:
# shellcheck disable=foo
^-- SC1073 (error): Couldn't parse this shellcheck directive. Fix to allow more checks.
                        ^-- SC1072 (error): Expected '=' after directive key. Fix any mentioned problems and try again.

For more information:
  https://www.shellcheck.net/wiki/SC1072 -- Expected '=' after directive key....
  https://www.shellcheck.net/wiki/SC1073 -- Couldn't parse this shellcheck di...

When in shellcheckrc:

$ shellcheck -s sh --rcfile <(echo 'disable=foo') /dev/null

In /dev/null line 1:

^-- SC1134 (error): Failed to process /dev/fd/63, line 1: Expected '=' after directive key. Fix any mentioned problems and try again.

For more information:
  https://www.shellcheck.net/wiki/SC1134 -- Failed to process /dev/fd/63, lin...

Here's what I wanted or expected to see:

Ideal: "foo-bar" is not a valid value for the "disable" directive, must be "all" or in the format SCxxxx, where xxxx is a shellcheck error code like 2086

Also good: "foo-bar" is not a valid value for the "disable" directive, or even just invalid directive

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions