Developer preview v1.1.2 — installation, packaging, and some platform support are still in progress. Read the status
Skip to content

Diagnostics ​

Every Clorraine diagnostic has a stable code. The registry records the trigger, the section, and the help text. The compiler prints the code in both human and JSON formats.

Explain a code ​

sh
clorraine --explain E10020

Output:

text
error E10020: '{name}' was moved and cannot be used
  trigger: Read, move, borrow, or drop of a moved value
  section: Ownership, moves, initialization, nullability, borrows (E100xx)
  help: re-initialize the binding or use a view

An unknown code is a usage error with exit code 2.

Human diagnostics ​

A normal compile failure prints a source location and help:

text
error E10020: 's' was moved and cannot be used
  --> examples/ownership-fail.clo:12:13
  help: re-initialize the binding or use a view

The location is one-based for both line and column.

JSON diagnostics ​

Use --diagnostics=json after the command:

sh
clorraine build --diagnostics=json -p host examples/ownership-fail.clo

Each diagnostic is one JSON object on stderr:

json
{
  "code": "E10020",
  "severity": "error",
  "message": "'s' was moved and cannot be used",
  "help": "re-initialize the binding or use a view",
  "file": "examples/ownership-fail.clo",
  "line": 12,
  "column": 13,
  "endLine": 12,
  "endColumn": 14
}

Fields that do not apply are null. Usage errors use the same shape with a null code.

Common codes ​

CodeMeaningTypical fix
E10020Use of a moved valueRe-initialize the binding or use a view
E10102Missing, ambiguous, or wrongly typed handle deleterDeclare one freedBy deleter with a take parameter
E10300Wrong number of type argumentsMatch the generic declaration
E10301Cannot infer type argumentsSupply explicit type arguments
E10400Capturing closure used as a function pointerInvoke it inline or use a capture-less lambda
E10404Capturing closure stored or returnedKeep it inline; it cannot escape
E11200Construct not available on the selected profileChange profile or remove the construct
E11201Unknown profile nameUse host, hosted-amiga, hosted-amiga-13, or freestanding
W10004Stack frame exceeds the profile thresholdReduce the frame or accept the warning deliberately

The complete registry is in spec/14-diagnostics.md. The machine-readable definitions live in the compiler's diagnostic registry.

Severity and exit status ​

  • An error fails the build with exit code 1.
  • A warning does not fail the build unless --deny-warnings is set.
  • A usage error exits with code 2.
  • run returns the program's exit code after a successful build, so check the build output separately when a run exits nonzero.

Reporting a diagnostic problem ​

If a diagnostic is wrong, misleading, or missing a source location, open an issue with:

  • The code and the exact message.
  • The smallest source that triggers it.
  • The command and profile.
  • What you expected instead.

A diagnostic is part of the language surface. A confusing message is a bug worth fixing.

Clorraine is an independent project. Amiga, AmigaOS, Kickstart, and Workbench are trademarks of Amiga Corporation. Not affiliated with or endorsed by Amiga Corporation or Hyperion Entertainment.