Skip to content

Error-code reference

Every diagnostic Tantu reports carries a stable code. The prefix tells you which stage produced it:

PrefixStageWhen
L###lextokenizing the source (indentation, characters, string literals)
P###parsebuilding the syntax tree
E####checktype checking (types, scopes, exhaustiveness, no-null, immutability)
R###runtimea panic while the program runs

Lex, parse, and check errors are compile-time (exit code 2), so the program never runs. Runtime panics (exit code 1) happen during execution and terminate the whole program with a stack trace.

CodeNameStageMeaning
E0001unsupportedcheckThis construct is syntactically valid but not supported in the current build.
E0101duplicatecheckA name is defined twice in the same scope.
E0102assign-immutablecheckAssignment to a let binding; declare it var if it must change.
E0103var-capturecheckA closure or fiber tried to capture a var; copy it into a let first.
E0104non-bool-condcheckThe condition of an if/while is not a Bool.
E0105non-exhaustivecheckA match does not cover every variant of the scrutinee's type.
E0106questioncheck? was used on an Option inside a Result-returning function (or vice versa).
E0107empty-listcheckThe element type of an empty list [] can't be inferred; add an annotation.
E0108missing-returncheckA function that should return a value ends in a Unit-typed statement.
E0109intrinsic-not-valuecheckAn intrinsic (like send) was used outside call position; it is not a value.
E0111unknown-namecheckA referenced name is not defined in any enclosing scope.
E0112type-mismatchcheckA value's type does not match the type expected here.
E0113not-comparablecheck==/!= used on a type Tantu does not treat as comparable.
E0114loop-controlcheckbreak/continue used outside a loop.
E0115unknown-typecheckA type annotation names a type that does not exist.
E0116return-outsidecheckreturn used outside a function body.
E0117not-callablecheckA non-function value was called.
E0118aritycheckA call passed the wrong number of arguments.
E0119cannot-infercheckA generic call is underdetermined; a type parameter couldn't be inferred.
E0120unreachablecheckA match arm can never be reached (a prior arm already covers it).
E0121not-a-variantcheckA pattern names a constructor that isn't a variant of the matched enum.
E0122variant-aritycheckA variant pattern or constructor has the wrong number of fields.
E0123constructor-not-valuecheckA bare enum constructor was used as a value instead of being called/matched.
E0124dup-variantcheckTwo variants of an enum share the same name.
E0130import-cyclecheckThe module import graph contains a cycle.
E0131module-not-foundcheckAn import names a module file that can't be found.
E0132not-a-module-membercheckA qualified access mod.member names a member the module doesn't export.
E0133module-not-valuecheckA module name was used as a value rather than accessed with .member.
E0134import-unsupportedcheckimport was used where there is no source file on disk (stdin/REPL).
E0135select-elsecheckA select's else arm must be the single, last arm.
E0136generic-not-valuecheckA generic function was used as a value; it is call-only; wrap it in a lambda.
L001tabs-in-indentlexTabs are not allowed in indentation; Tantu indents with spaces only.
L002bad-dedentlexAn unindent does not line up with any enclosing indentation level.
L003illegal-charlexAn illegal character appeared in the source.
L004invalid-escapelexAn unknown escape sequence appeared inside a string literal.
L005unterminated-stringlexA string literal was opened but never closed before end of line/file.
L006invalid-numberlexA numeric literal is malformed, for example a misplaced underscore like 1_, _5, or 1._5.
P001unexpected-tokenparseAn unexpected token was found where the grammar expected something else.
P002unexpected-eofparseThe source ended in the middle of a construct the parser was still reading.
P003too-deepparseExpression, type, or pattern nesting is too deep for the parser to read safely.
R001div-by-zeroruntimeDivision or modulo by zero at runtime.
R002index-out-of-rangeruntimeA list index was out of range at runtime.
R003send-closedruntimeA send was attempted on a closed channel.
R004close-closedruntimeA channel was closed twice.
R005deadlockruntimeDeadlock: every fiber is blocked and none can make progress.
R006uninitruntimeA global was read before its initializer ran.
R007match-failruntimeA match at runtime found no matching arm (should be prevented by the checker).
R008step-limitruntimeExecution exceeded the playground's instruction budget (runaway loop safeguard).
R009builtinruntimeA builtin hit a domain error at runtime (for example converting nan/inf to an integer).
R010stack-overflowruntimeThe call stack overflowed; recursion exceeded the frame cap.
R011bad-capruntimeA channel was created with a negative capacity.

Generated

The code list is pulled directly from the interpreter's error registry (tantu/errors.py), so a new code can't silently go undocumented.

Many of these are explained in context: immutability and no-null (E0102, E0103, E0106, E0107) in Types & no-null, exhaustiveness (E0105, E0120) in Pattern matching, closures (E0103) in Functions & closures, generics (E0119, E0136) in Generics, and imports (E0130E0134) in Modules.