Error conditions

Errors fall into two classes: compile-time errors, which prevent a script from loading at all, and run-time errors, which terminate a single execution. Structural problems are caught at compile time; type, name, arity, and resource problems are caught at run time.

Compile-time errors

A compile-time error produces an error message and no runnable script. These reflect problems in the source's lexical form, structure, declarations, or command shapes, as grouped below.

Lexical

Structural / syntactic

Declaration / namespace

Command-shape

Run-time errors

A run-time error terminates the running execution.

Type errors

Raised when an operation's operand has the wrong type:

Type-error messages name the offending argument and the expected and actual type (Types lists the type-name strings).

Name and binding errors

(Undefined $name, set of an unbound or immutable name, and duplicate let/const in a scope are all compile-time errors, not run-time ones.)

Arity errors

Value errors

Stale entity references

Resolving a creature or object reference whose entity has been destroyed terminates the script (Types). This termination ends the execution quietly — no error message is produced.

Resource limits

Exceeding any of the execution bounds described in Run-time — the per-execution work budget, recursion depth, or expression-nesting depth — terminates the script with an error.

Error reporting

An execution terminates at the first error; no further errors from the same execution are possible. Error messages include the source line when it can be determined. There are no exceptions and no try/catch; a run-time error always terminates the current execution.