← Back to Docs


Error Reference

All InScript error codes with examples and fixes.

E000x — Lexer Errors

E0001
LexerError
General lexer error — unexpected character or malformed token.
E0002
UnknownChar
Unrecognized character in source. Check for typos or paste artifacts.
E0003
UnterminatedString
String literal not closed. Add a closing ".
let s = "hello   // ❌ missing closing quote
let s = "hello"  // ✅

E001x — Parse Errors

E0010
ParseError
Syntax error — unexpected token. Check brackets, keywords, and spacing.
E0011
UnexpectedToken
Got a token that doesn't fit here. Common causes: missing {, extra keyword, wrong operator.
E0012
MissingToken
Expected a token (like ) or }) but found something else.
fn f(x  { return x }  // ❌ missing )
fn f(x) { return x }  // ✅
E0013
UnbalancedBrace
Mismatched {} [] (). Count your opening and closing brackets.

E002x — Semantic / Analyzer Errors

E0020
SemanticError
Type or scope error found by the static analyzer before execution.
E0021
UndefinedName
Variable/function not declared in this scope.
print(x)        // ❌ x not defined yet
let x = 5
print(x)        // ✅
E0022
AlreadyDeclared
Name already defined in this scope. Rename or use a different scope.
E0023
TypeMismatch
Value doesn't match the declared type annotation.
let x: int = "hello"   // ❌ string ≠ int
let x: int = 42        // ✅

E004x — Runtime Errors

E0040
InScriptRuntimeError
General runtime error — method not found, wrong argument type, etc. The most common error. Check the message for the specific cause.
E0041
TypeError
Operation on wrong type.
let x = 5 + "hello"  // ❌ int + string
let x = 5 + 10       // ✅
E0042
NameError
Undefined variable at runtime. Did you mean: hint shown if similar name exists.
E0043
IndexError
Array index out of bounds.
let a = [1,2,3]
print(a[5])   // ❌ index 5 out of range (len=3)
print(a[2])   // ✅ last element = 3
E0044
ImportError
Module not found. Check the module name — use .modules in REPL to see all 59 available modules.
E0045
DivisionByZero
Integer division by zero. Use float division if you want Infinity: 1.0 / 0.0 = Infinity.
E0046
StackOverflow
Too deep recursion. Add a base case or increase the limit.
E0047
MatchError
Non-exhaustive match — no arm matched. Add case _ { } as a wildcard.
E0049
NilAccess
Accessed field/method on nil. Use ?.  optional chaining or check with x != nil.

E005x — Assert / Panic

E0050
AssertionError
assert(cond, msg) failed. The catch variable receives the message string directly.
E0051
Panic
panic(msg) called. Use for truly unrecoverable states.
E0052
Unreachable
unreachable(msg) reached. This is a programmer error — the code path was supposed to be impossible.