Zornux docs
Get started Spec

Reference

Diagnostics

Diagnostics are a first-class feature. The compiler reasons about what you were trying to express and offers a literal correction — never a stack trace.

What a diagnostic shows you

A Zornux error tells you the code, where it happened, what went wrong in plain English, and how to fix it:

text
error[ZX0103]: I expected 'end' to close this 'if' block.
  --> minor.zx:1:1
   |
 1 | if age is less than 18
   | ^ this block is still open
   |
 help: add 'end' on a new line after the last statement of the block.

Authoring rules

  • Speak to a beginner — "I expected…", "I could not find…", never "unexpected token".
  • Name what was expected and what was found, in human terms.
  • Offer a fix when one is unambiguous.
  • No internals leak — AST node names and host exceptions never appear.
  • One problem, one diagnostic — recovery prevents cascading noise.
  • Codes are forever — once shipped, a code's meaning is frozen.

Code ranges

Every code is ZX plus four digits, reserved per subsystem:

RangeSubsystem
ZX0001–0099Lexer (characters, tokens, strings)
ZX0100–0299Parser (grammar / structure)
ZX0300–0399Semantic analysis & names
ZX0400–0499Compiler
ZX0500–0699Type system
ZX0700–0899Runtime
ZX0900–0999Classes (OOP)
ZX1000–1099Standard library
ZX1100–1199Web services
ZX1200–1299Security
ZX1300–1399Module system
ZX1400–1499Package manager
ZX1500–1599Testing framework
ZX1600–1699Documentation generator
ZX1700–1799Debugger
ZX1900–1999Application entry point
ZX2000–2099Structured concurrency
ZX2100–2199Error recovery (try)
ZX2200–2299Maps / dictionaries
ZX2300–2399Async execution
ZX2400–2499Data layer / ORM
ZX2500–2599Enterprise application layer
ZX2600–2699Configuration, secrets & environment
ZX2700–2799Middleware & request pipeline
ZX2800–2899Logging & observability
ZX2900–2999Advanced authorization
ZX3000–3099Background processing
ZX3100–3199Advanced data / queries
ZX3200–3299Messaging & event bus
ZX3300–3399Enterprise hardening
ZX3400–3499Remote package registry
ZX3500–3599ORM migrations & schema evolution
ZX3600–3699Native deployment & hosting
ZX3700–3799Security analyzer (advisory rules ZX3701–3711)
ZX3800–3899Memory safety & resource limits
ZX3900–3999Profiling
ZX4000–4099Static analysis (definite-assignment, reachability, type & relationship audit)

A few in the catalog

CodeMessage
ZX0002This text string is missing its closing quote ".
ZX0103I expected 'end' to close this if block.
ZX0104'repeat' needs a count followed by 'times'.
ZX0110'function' is a reserved word and can't be used as a name.
ZX0700I don't know what 'name' is — it was never created.
ZX0706I can't divide by zero.
ZX1205This value is untrusted and must be checked before it's combined with trusted text.
ZX2504Validation failed — a record broke its rules.
ZX3001There's no job named 'SendWelcome'.
ZX0119This is nested too deeply to parse.
ZX0957This property is read-only and can't be assigned.
ZX0731There's no parameter named 'timeut' here. Did you mean 'timeout'?
ZX1051This regular expression timed out — it backtracks too much on this input.
ZX1316'internal_helper' exists in module 'users' but isn't public.
Machine-readable too

Every diagnostic also serializes to JSON (code, severity, message, file, range, help) for editor tooling and CI.