Skip to content

Failures ​

Handles a run that cannot finish. The run stops, reports no findings, explains the cause and exits with code 2. Findings, even errors, are not failures: a run that completes exits 0 or 1.

Any block can raise a LintFailure, which carries a stable code, a message about this occurrence and a help line with the next step. It may also name the file involved and, for a rule crash, the rule, or for a plugin crash, the plugin. Anything else thrown during the run is reported as INTERNAL_ERROR. A stack trace is never part of the output.

CodeRaised byWhen
USAGE_ERRORCLIThe arguments are wrong
CONFIG_INVALIDConfig, Plugins and rule set, SuppressionsThe config is missing, unreadable or invalid, a plugin fails to load or check, or an entry matches several expressions
INPUT_NOT_FOUNDInputsA path given does not exist
INPUT_PATTERN_UNMATCHEDInputsA glob or directory selects no files
INPUT_UNREADABLEInputsA file or directory cannot be read
INPUT_INVALID_JSONInputsA file is not valid JSON
NO_QUESTIONNAIRESInputsThe files hold no Questionnaire
RULE_CRASHRule runnerA rule throws, returns a promise or reports an invalid finding
PLUGIN_CRASHName analysis, through a plugin's hostVariables hookThe hook throws, returns a promise or returns something other than a list of names
INTERNAL_ERRORAnyAnything else: a bug in the linter

Codes are stable and never reused for another cause, so scripts branch on the code, not on the message.

stderr always gets two lines, in every format:

text
error: no Questionnaires found in fsh-generated/resources
help: run sushi . to generate fsh-generated/resources, then lint again; or pass paths to Questionnaire or Bundle JSON files, or list them in files in the config

stdout gets what the format can carry, so automation reads the failure where it reads the report:

Formatstdout on failure
textNothing
jsonA report with status: "failed" and the failure, and no findings or summary
githubOne error annotation titled with the code, and a section in the job summary
sarifA SARIF log with no results, and the failure as a tool notification

Failures in the report format defines the failure record.

Schema ​

Code ​

  • failure.ts: the failure codes, the LintFailure class, asLintFailure for anything else thrown, renderFailureText for stderr, and renderFailureOutput for stdout in each format.
  • cli/run.ts: writeFailure writes it and returns exit code 2.
  • run/host-variables.ts: raises PLUGIN_CRASH when a plugin's hostVariables hook fails.
  • report/github.ts and report/sarif.ts: the GitHub and SARIF output of a failure.