Error codes
Every stable diagnostic Wit can raise: 12 parser codes plus 14 runtime codes,
and the one non-coded wit build message. Paste a code here to find
its cause and fix.
Parser codes — 12
Raised during lex and parse, before any name is resolved. Source: packages/parser/src/errors.ts.
| Code | Cause | Fix |
|---|---|---|
| E_UNCLOSED_NODE | a block opener with no matching close | add the close or use a self-closing form |
| E_UNCLOSED_COMMENT | a block comment never terminated | close the comment |
| E_UNCLOSED_DEFINITION | a def with no close or double-bang | add the close or the double-bang |
| E_UNCLOSED_PAREN | a parens call never closed | add the closing paren |
| E_MISMATCHED_CLOSE | close name differs from open name | make the close name match the open |
| E_MALFORMED_RECORD | a bad record literal | use the hyphen delimiter in data-defs |
| E_UNCLOSED_COLLECTION | a collection never closed | add the closing bracket |
| E_UNCLOSED_SCRIPT | a script with no percent-close | close the script |
| E_UNCLOSED_RAW_NODE | a raw node with no double-at close | add the matching close |
| E_MIXED_PARAM_SOURCE | opened one param form then added another | the form you open with is the form that closes |
| E_MALFORMED_FORM_FIELD | a malformed form-fill field line | fix the key colon value shape |
| E_UNTERMINATED_STRING | a quoted string not closed | add the closing quote |
Runtime codes — 14
Raised during resolve and expand. Source: packages/runtime/src/errors.ts.
| Code | Cause | Fix |
|---|---|---|
| E_UNRESOLVED_REFERENCE | a name binds to no definition | define it or fix the spelling |
| E_CIRCULAR_REFERENCE | a reference or def cycle | break the cycle |
| E_MISSING_REFERENCE_FILE | a reference path does not exist | correct the path |
| E_MISSING_FIELD | dotted access to an absent field | check the field name — access is fuzzy |
| E_PARTIAL_SHAPE_MISMATCH | an additive partial conflicts with the base | match the base shape |
| E_TYPE_MISMATCH | a value-type mismatch in a comparison or use | compare like with like |
| E_DUPLICATE_DEFINITION | two non-additive defs share a name | rename or make it additive |
| E_EXPANSION_DEPTH_LIMIT | expansion recursion cap hit | remove the runaway self-reference |
| E_NOT_ITERABLE | each over a non-collection | iterate a collection def |
| E_AMBIGUOUS_RECORD_KEY | a fuzzy key match tie | disambiguate the key |
| E_SCRIPT_ERROR | a script threw | fix the script body |
| E_MISSING_RECORD_FIELD | a record-arg omits a required capture | supply the missing field |
| E_EXTRA_RECORD_FIELD | a record-arg supplies an unexpected field | drop the extra field |
| E_LOAD_FAILED | load has no alias or exec is disabled or the program errored | configure the source and pass --allow-exec |
Non-coded message
E_UNKNOWN_OUTPUT_FORMAT — a wit build message (not a WitError) when the -o extension is unrecognised and no --format is given. Exit 1.
Verified repros
Each snippet below produced exactly the diagnostic shown.
@blockquote hi → E_UNCLOSED_NODE: unclosed @blockquote @blockquote hi quote@ → E_MISMATCHED_CLOSE: expected blockquote@ but got quote@ @@pre hi → E_UNCLOSED_RAW_NODE: unclosed @@pre (expected pre@@) <% a = 1 → E_UNCLOSED_SCRIPT: unclosed <% script block @undefined → E_UNRESOLVED_REFERENCE: Unresolved reference @undefined #x: 1 #x: 2 @x → E_DUPLICATE_DEFINITION: Duplicate definition #x
The greedy-bind trap (a pipes form before a later block use of the same node)
surfaces as E_UNCLOSED_NODE — see gotchas.