Diagnostic Codes
Diagnostic codes are stable identifiers for tooling, tests, and educational explanations. The message adds context, but code-based handling should use the code. Codes are grouped by failure layer; a missing number is reserved and has no current meaning.
Syntax And Parsing (NLK1xxx)
Section titled “Syntax And Parsing (NLK1xxx)”| Code | Meaning |
| --------- | ---------------------------------------------------------------------------------------------------- |
| NLK1001 | Invalid token or character. |
| NLK1002 | Invalid indentation, including tabs or an unmatched dedent. |
| NLK1003 | Unterminated string, block comment, delimiter, or other construct. |
| NLK1004 | Required token or syntactic form is missing. |
| NLK1005 | Recognized but unsupported syntax, such as a slice step, comparison chain, or unknown string escape. |
| NLK1006 | The implementation’s structural syntax-nesting limit was exceeded. |
Names, Structure, Types, And Effects (NLK2xxx)
Section titled “Names, Structure, Types, And Effects (NLK2xxx)”| Code | Meaning |
| --------- | -------------------------------------------------------------------------------- |
| NLK2001 | A variable is not defined on the current path. |
| NLK2002 | A called function is not available at that source position. |
| NLK2003 | Duplicate value, function, parameter, or related declaration. |
| NLK2004 | A reserved built-in name was rebound. |
| NLK2005 | Invalid function structure, such as a misplaced or non-final return. |
| NLK2006 | Statement is illegal in this scope or placement. |
| NLK2007 | Call arity or named-argument binding does not match the signature. |
| NLK2008 | Type annotation is unknown, malformed, or invalid for that position. |
| NLK2009 | A recoverable error could flow directly into a context that requires success. |
| NLK2010 | try or catch is invalid for the operand’s error effect. |
| NLK2011 | A value does not satisfy an annotated parameter, assignment, or return contract. |
| NLK2013 | Code attempts to compare an error value. |
| NLK2014 | A recursive container operation cannot prove its required safety constraint. |
Commit Loops (NLK3xxx)
Section titled “Commit Loops (NLK3xxx)”| Code | Meaning |
| --------- | ------------------------------------------------------------------------------------ |
| NLK3001 | init is not paired with a legal commit loop. |
| NLK3002 | Primed assignment is illegal in this position. |
| NLK3003 | Primed state is read where next-state reads are forbidden. |
| NLK3004 | A primed name uses the wrong prime depth for the current loop. |
| NLK3005 | The same primed target is assigned more than once in a round. |
| NLK3006 | A commit-loop guard is statically constant. |
| NLK3007 | A nested commit loop is placed where its parent state cannot be materialized safely. |
| NLK3008 | Commit-loop state is updated directly instead of through the next-state layer. |
| NLK3009 | A while commit loop is missing its required adjacent init block. |
| NLK3010 | A pragma is unknown or placed outside its legal loop position. |
| NLK3011 | rhs_prime uses an unknown guarantee name. |
| NLK3012 | Primed read dependencies form a cycle and cannot be scheduled. |
Runtime Values (NLK4xxx)
Section titled “Runtime Values (NLK4xxx)”| Code | Meaning |
| --------- | ---------------------------------------------------------------------------- |
| NLK4001 | Runtime type error. |
| NLK4002 | Value is of the right broad type but outside an operation’s valid domain. |
| NLK4003 | A requested dict key or set element is absent. |
| NLK4004 | A sequence index is out of range. |
| NLK4005 | A sparse next-state container location is updated more than once in a round. |
| NLK4006 | An unhandled error value reached a context that cannot consume errors. |
NLK4002, NLK4003, and NLK4004 become recoverable err values only for operations explicitly
registered as safe value-level operations. Examples include list.get, one-argument dict.get,
list.pop, list.index, set.remove, num, ord, and chr. Raw indexing and type/arity
failures remain fatal. Handle a registered failure with catch, propagate it from an error-capable
function with prefix try, or retain it in an explicitly error-capable annotation.
Resource And Internal Failures (NLK5xxx)
Section titled “Resource And Internal Failures (NLK5xxx)”| Code | Meaning |
| --------- | ------------------------------------------------------------------------------- |
| NLK5001 | Configured global commit-loop round limit exceeded. |
| NLK5002 | Runtime nested-loop depth limit exceeded. |
| NLK5003 | Configured source prime-depth limit exceeded. |
| NLK5005 | Function call-depth limit exceeded. |
| NLK5006 | Runtime value size, nesting, repetition, or allocation limit exceeded. |
| NLK5999 | Interpreter invariant failed; this normally indicates an implementation defect. |
All NLK1xxx, NLK2xxx, NLK3xxx, NLK5xxx, NLK4001, NLK4005, and NLK4006 diagnostics are
fatal. Fatal means the current run does not produce a normal program result and the CLI exits with
status 1.