Understanding Sifr Diagnostics and Error Reporting
Learn how Sifr reports errors and warnings, interpret severity levels, choose output formats, and suppress lint rules safely in your Sifr projects.
Sifr surfaces every compiler diagnostic with a stable, machine-readable code in the format SIFR-<FAMILY>-dddd. Whether you are reading terminal output, wiring up a CI pipeline, or integrating an editor extension, the same structured information is always available — you only choose how it is rendered. This page explains the diagnostic system from end to end: output formats, severity levels, the --diagnostic-format flag, the JSON envelope schema, exit codes, and how to suppress lint rules when needed.
Every diagnostic carries one of three severity levels.
Severity
Meaning
Error
A hard compiler error that prevents compilation. The build will not produce an artifact.
Warning
A condition that compiles successfully but signals a potential problem.
Note
Informational output, such as a revealed type from reveal_type().
Only Error-severity diagnostics block a successful build. Warning and Note diagnostics are emitted alongside the build result and do not prevent artifact generation on their own.
Compiler-facing commands (sifr build, sifr run, sifr check, sifr emit) accept the --diagnostic-format flag with three values: human, json, and compact. The default is human.
The human format is designed for developer terminals. It renders source file locations, code snippets, caret highlights, related spans, notes, help text, code-action suggestions, and documentation URLs whenever span data is available. Spanless internal diagnostics fall back to an explicit location: <unavailable> line.
error[SIFR-TYPE-0002]: type mismatch: expected int, got str --> src/main.sifr:7:12 | 7 | x: int = "hello" | ^^^^^^^ expected `int`, found `str` | = help: remove the string literal or change the type annotation to `str` = docs: https://docs.sifr-lang.org/diagnostics/error-codes#sifr-type-0002
Human progress text (Finished, Binary:, phase summaries) is written to stderr only in human format. Do not grep for these words in scripts — use compact or json instead.
The compact format is a stable, line-oriented format suited for CI pipelines, agents, and quick terminal scanning. It emits a one-line summary followed by one line per diagnostic after recovery limiting. The first four fields on each diagnostic line are stable: severity abbreviation, code, location (or <unknown>), and message.
The json format emits a DiagnosticEnvelope object to stdout. It is the canonical format for editor integrations, language servers, and any tool that needs to consume structured diagnostic data. Successful builds in json mode emit no human progress text on stdout or stderr.
Sifr commands use consistent exit codes across all subcommands.
Code
Meaning
0
Success — compilation completed with no errors.
1
Diagnostic error — one or more Error-severity diagnostics were emitted, or (for sifr lint) policy diagnostics remain unfixed.
2
Configuration or usage error — invalid flags, a missing or malformed manifest, or a bad command invocation.
3
Internal panic — an unrecoverable compiler-internal failure occurred after the panic boundary.
Exit code 3 indicates a compiler bug, not a user error. If you encounter it, please report the SIFR-INTERNAL-0001 diagnostic output along with a minimal reproduction to the Sifr issue tracker.
Both forms print the diagnostic description, message template, severity, and any relevant guidance without performing a build or package operation. This works even for retired codes — for example, sifr --explain SIFR-PACKAGE-0105 redirects you to the replacement code SIFR-PACKAGE-0101.
Sifr’s policy-rule engine (sifr lint) emits suppressible Warning-level diagnostics. You can silence a specific rule on a single line using an inline comment:
value = legacy_call() # sifr: ignore[rule-id]
Replace rule-id with the exact Sifr rule identifier such as todo-comment, trailing-whitespace, or boolean-positional-argument.
Blanket suppressions — comments that do not name at least one explicit rule ID — are rejected by the compiler. Sifr will emit SIFR-LINT-0003 and will not apply the suppression.
Suppressions apply only to policy diagnostics from sifr lint. Hard compiler errors (Error-severity diagnostics from sifr check or sifr build) cannot be suppressed with inline comments.
Sifr also reports two additional lint-related warnings to keep suppression hygiene clean:
SIFR-LINT-0001 — the rule ID in a suppression comment does not match any known policy rule.
SIFR-LINT-0002 — the suppression comment is present but did not actually suppress any diagnostic on that line.
To audit all suppressions without applying them, run sifr lint --ignore-suppressions. This flag does not affect per-file ignores or hard compiler diagnostics.