Skip to content

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.

Code Meaning
NLK1001 Invalid token or character.
NLK1002 Invalid indentation, including tabs or an unmatched dedent.
NLK1003 Unterminated string literal or block comment.
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: a path that finishes without returning, or dead code.
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.
NLK2015 No file exists for an imported module.
NLK2016 An imported module has no definition with the imported name.
NLK2017 Imports form a cycle.
NLK2018 An imported file contains a statement other than a definition.
NLK2019 A name clashes with an import or is used before its import.
NLK2020 A module or function is used as a value, or an attribute is read from a value.
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 an equation-mode 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 acc_prime uses an unknown mode name.
NLK3012 Commit-loop dependencies form a cycle and cannot be scheduled.
NLK3013 A recognized accumulation mode has no implemented evaluator or verifier yet.
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 location is updated more than once in an equation-mode 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.

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.
NLK5007 A program loads too many files or nests imports too deeply.
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.

An unclosed (, [, or { keeps NLK1004 and the expected closing token, but points at the opening bracket with a label such as This ( was never closed. A quoted module import reports import takes a module name, not text in quotes: import geometry. Obvious generic follow-ups from parser recovery in the same statement are suppressed; independent errors remain visible.

When a function tries to read top-level or imported data, NLK2001 starts with ‘SIDES’ can’t be read inside a function. Its help says Pass ‘SIDES’ as a parameter. Functions can still call other functions, including imported ones.

A printing procedure used as a value reports NLK2006 with ‘f’ prints, so it can’t be used as a value. Call it on its own line. This includes procedures that print through another function. Name-replacement quick fixes in the editor use labels such as Change totl to total.