Documentation

Diagnostics

Walnut reports compiler problems with a banner and stable code, a clear message, a source snippet with a caret, and optional Hint lines.

Example

init =
    { count: 0 }
-- PARSE ERROR WN0103 ----------------------------- Main.walnut

15|     { count: 0 }
              ^

I was parsing a record and expected `=` after the field name, but found `:`.

Hint: Record fields use `name = value`.
      Try `{ count = 0 }`.

Record fields use = in Walnut. Type annotations in record types still use :.

Reading a diagnostic

PieceMeaning
Banner (PARSE ERROR, TYPE ERROR, …)Stage that failed
WN####Stable error code
Line + ^Where in the file
Primary messageWhat went wrong (below the snippet)
Hint:What to try next

Color

TTY output is colorized. Disable color with walnut check --plain, NO_COLOR=1, or WALNUT_PLAIN=1 (layout stays multi-line).

Parse vs type

  • Parse: first error per file.
  • Type: collect-all — one check can list many type errors.

Editors

walnut lsp includes the WN#### code and hint text in editor diagnostics.

Agent tip

Read the full diagnostic (code + caret + Hint) before changing code.