Diagnostics Directory
Reading a diagnostic
Every message follows one shape: a short code, a plain sentence, a pointer at the exact column, and a fix hint. Reference to an undeclared name produces:
┌─ error[E303]: undefined variable `nosuchvar`
│ src/main.rnx:1:26
│
│ 1 │ fn main(): Int { let x = nosuchvar + 1; return x; }
· │ ▲
│
└─ note: declare the variable with `let` or check the spellingInside-out, the box states:
- The code:
E303. Codes starting withEare errors (exit 1);Wcodes are warnings (exit 0 unless--deny-warnings). Codes are stable across releases: they are searchable on this page, expandable withrnx explain E303, and matchable in CI withrnx check --json. - The message: one sentence naming the problem in program terms, never compiler internals.
- The location: file, line, and column, with a source excerpt and a
▲pointer under the exact column. - The note: the fix, what to type next.
Warnings print in yellow without failing the build. Fatals (fatal: ...) report runtime stops, traps and failed assertions, in the same box shape with the function and span where execution stopped. Uncaught throws print as Uncaught exception: <value> on stderr with a Stack trace: section naming the stop site instead of a box. Errors stop the pipeline; when several appear, the first is fixed first, since later errors are frequently downstream echoes.
rnx explain expands any code into full text plus fix:
rnx explain E303E303: undefined variable
fix: declare the variable with `let` or check the spellingLexical codes (E005)
| Code | Severity | Cause | Resolution |
|---|---|---|---|
E005 | error | removed :: syntax (paths, variants, generics use . and <>) | replace :: with . |
Module and declaration codes (E105-E112)
| Code | Severity | Cause | Resolution |
|---|---|---|---|
E105 | error | fn(...) => ... lambda form; fn declares named functions with block bodies only | use (params) => body for lambdas |
E107 | error | circular package dependency; reserved for external package graphs, never emitted for intra-project file imports | break the dependency cycle between packages |
E108 | error | general compile error: single-statement if bodies holding declarations, pub signatures with non-C-compatible types, missing operator hooks, unknown packages, and related structural violations | read the message; it names the exact rule (declarations need { ... }, hooks name the operator and type) |
E109 | error | await outside an async fn (entry-file top level is exempt) | move the await into an async fn or to the entry file top level |
E110 | error | C-style for (init; cond; step) | use for x in range or while |
E111 | error | direct .poll() call; the polling model is retired | use await or promise.wait() instead |
E112 | error | loose top-level statement or top-level await in an imported module | move execution logic into a function or class method; top-level statements live in the entry file only |
E113 | error | the registry is unreachable (connection refused, DNS failure) or the cache has no copy of the requested package | run rnx download to seed the cache, or check the network |
E114 | error | the package's engine range does not admit the running toolchain | run rnx update to move to a compatible version, or rnx download to re-seed the cache |
E115 | error | a registry range floats with no locked version in Project.deplock | run rnx lock to pin every registry dependency, then build again |
E116 | error | a chunk manifest lists more than 4096 entries | run rnx update to move past this version or ask the maintainer to split the package |
E117 | error | a #[CompTime] function ran past the 1,000,000-step fuel budget | simplify the comptime function |
E118 | error | a #[CompTime] function exceeded the call depth cap of 64 | flatten the comptime recursion |
E119 | error | a macro expansion produced more than 10,000 nodes | split the expansion across smaller macros |
E120 | error | macro expansion did not reach a fixed point after 8 rounds | stop the macro from emitting macros that expand forever |
E121 | error | a derived method would collide with an existing member | rename the existing member or drop the derive |
E122 | error | comptime sandbox or file-input violation (EmbedBytes! path, foreign call, I/O in build-time code) | keep comptime pure: literals, type info, and EmbedBytes! bytes only |
E123 | error | a StaticAssert! condition is false or not constant | fix the asserted expression or drop the assertion |
E124 | error | a target pack is missing, corrupt, or does not match the lock | run rnx sysroot add <triple> to install the target pack, or rnx sysroot verify <triple> to rehash an installed one |
The E108 declaration rule, corrected:
let x = 1;
if x > 0 {
let y = 2;
println!(y);
}Each remaining code, with its trigger:
let data = await Promise.resolve(42);
println!(data);Top-level await is legal only in the entry file. The same await inside an imported module is E112, and await inside a synchronous function body is E109. Move it into an async fn.
async fn compute(): Int {
return 41 + 1;
}
let result = await compute();
println!(result);fn tag(n: Int): String {
switch n {
case 1: return "one";
case 2: fallthrough;
case 3: return "two-or-three";
default: return "other";
}
}Each case auto-breaks; crossing into the next case needs the explicit fallthrough;. An empty case with neither a body nor fallthrough; is E108. A C-style for (init; cond; step) header is E110. Use for x in range or while. A direct .poll() call is E111. Use await or promise.wait() instead.
let total = nosuchvar + 1;
println!(total);Reference to a name with no visible declaration fails as E303 pointing at the exact column (lowercase-led value names; PascalCase names are type references that single-file checks leave alone). A return value of the wrong type fails as E304 with expected/got labels. An intra-procedural ARC cycle without escape fails as E302. Restructure so the value escapes, or route the back-edge through GenRef.
Cycle, manifest, and lint triggers
class Ticker {
let cb: fn(): Int;
init() {
this.cb = fn decay(this) { return 1; }
}
}Without fn decay(this), a self-capturing closure warns as W104. A mutual strong pair A<->B warns as W108 (convert one side to GenRef); an #[Allow(CyclicReference)] field never cleared warns as W109 (clear it in deinit or a clear*/close*/reset* method). An unrecognized manifest section or field warns as W201 and is ignored.
| Lint | Trigger | Silence |
|---|---|---|
L001 | let/const never read | _ prefix |
L002 | parameter never used | _ prefix; empty trait methods exempt |
L003 | statements after return, throw, break, continue | remove them |
L004 | pub item without /** */ docs | document it |
L005 | empty {} in if, while, defer, try, or unsafe | remove the block or add pass |
Security code triggers
| Code | Trigger | Fix |
|---|---|---|
S101 | deduced capabilities exceed the Project.deplock ledger | approve the capability and re-lock, or remove the use |
S102 | capability outside the [permissions] ceiling | narrow the code or deliberately widen the ceiling |
S201 | delegated argument modified before reaching a sink | pass it through untouched or request the ambient grant |
S301 | dependency code targeting Project.config, Project.deplock, .git, or cache dirs | never target those paths; the abort is the enforcement |
S401 | unapproved child process execution | add a covering sys:exec:<name> grant with explicit approval |
S501 | capability analysis timeout | split the package into smaller modules; never skip the scan |
Boundary codes (E201-E204)
| Code | Severity | Cause | Resolution |
|---|---|---|---|
E201 | error | call to an unsafe fn or a foreign (from native) function outside an unsafe block | wrap the call in unsafe { ... } |
E202 | error | address-of (&x) or Pointer arithmetic outside unsafe | move the operation into an unsafe block |
E203 | error | private field, method, or module item accessed outside its scope | widen visibility or access through the owning scope |
E204 | error | class invoked as a direct call (Meter(20)) instead of new | instantiate with new Meter(20) |
class Meter {
let v: Int;
init(v: Int) { this.v = v; }
}
let m = Meter(20);The direct call fails with E204; new Meter(20) is the fix.
Binding codes (E205-E206)
| Code | Severity | Cause | Resolution |
|---|---|---|---|
E205 | error | assignment type mismatch: the value type is not assignable to the variable type | declare the variable as Any for dynamic reassignment, or use T? for nullable bindings |
E206 | error | let/const without an initializer | add = <expr> (reported instead of E108, with recovery on ;) |
let count: Int = 0;
count = "forty-two";The reassignment fails with E205: a String is not assignable to an Int binding. Declaring the variable as Any is the fix.
let count: Any = 0;
count = "forty-two";A const declared without an initializer fails with E206.
const limit: Int;Adding the initializer is the fix.
const limit: Int = 10;Type and ownership codes (E302-E305)
| Code | Severity | Cause | Resolution |
|---|---|---|---|
E302 | error | intra-procedural ARC cycle without escape | restructure so the value escapes, or route the back-edge through GenRef |
E303 | error | reference to a value name with no visible declaration; applies to lowercase-led names only (PascalCase names are type references that single-file checks leave alone) | declare with let or correct the spelling |
E304 | error | return value does not match the declared return type, with expected/got labels | align the returned value with the signature |
E305 | error | implicit Float/FastFloat mix in one expression | convert explicitly with .asFast()/.asStrict() |
let strict: Float = 0.5;
let fast = strict.asFast();
println!(fast * 2.0.asFast());Packaging codes (E402, E501)
| Code | Severity | Cause | Resolution |
|---|---|---|---|
E402 | error | schema mismatch in a typed file: import | align the import schema with the file |
E501 | error | publish attempted without a publisher token | pass --token <token> or set RNX_TOKEN |
Security codes (S101-S501)
Capability and permission failures. The full model (capability grammar, [permissions] ceilings, tiers, and the rnx audit / rnx lock workflow) is specified in Project and Toolchain. Summaries are transitive: each module is charged its own sinks plus the summaries of the modules it imports (bare, renamed, and chained calls attribute identically), so ceilings must cover the transitive closure. Runtime internals (__rnx_*) are never referenced bare: the only legal declaration is import { fn name(params): Ret } from runtime "mod" inside registry-verified @std/*, and any other frame is rejected with E108 naming the owning @std/* wrapper.
| Code | Severity | Cause | Resolution |
|---|---|---|---|
S101 | error | capability mismatch: deduced capabilities exceed the Project.deplock ledger | approve the capability and re-lock, or remove the offending use |
S102 | error | permission ceiling exceeded: a capability outside [permissions] allowed | narrow the package code or deliberately widen the ceiling |
S201 | error | untrusted path mutation: a delegated argument modified before reaching a sink | pass the delegated value through untouched or request the ambient grant |
S301 | runtime trap | protected path violation: dependency code targeting Project.config, Project.deplock, .git, or cache dirs | never target those paths from dependency code; the abort is the intended enforcement |
S401 | runtime trap | unapproved child process execution | add a covering sys:exec:<name> grant with explicit approval |
S501 | error | capability analysis timeout | split the package into smaller modules; never skip the scan |
Cycle warnings (W104-W109)
| Code | Severity | Cause | Resolution |
|---|---|---|---|
W104 | warning | self-capturing closure without decay | capture GenRef(this) with fn decay(this) |
W108 | warning | mutual strong fields A<->B | convert one side to GenRef |
W109 | warning | #[Allow(CyclicReference)] field never cleared to null | clear the field in deinit or a clear*/close*/reset* method |
Manifest warnings (W201)
| Code | Severity | Cause | Resolution |
|---|---|---|---|
W201 | warning | unrecognized manifest section or field; ignored | correct the spelling or remove the entry |
Native, task, and pipeline errors (E108)
Native sources, author tasks, and the publish pipeline reuse E108; the message always names the cause. No new codes were added for this surface.
| Message (abridged) | Cause | Resolution |
|---|---|---|
`system: true` and `from` cannot combine | host libraries have no image titles | drop from (host source) or drop system: true (bundled source) |
vendored `path` and `system: true` cannot combine (likewise version, from) | a checkout is already a source | keep path alone for vendored code |
`from: "t"` needs the package's own `artifacts` image | titles resolve against the declared image | declare artifacts: "host/org/repo" first |
`` system library z reports 1.2.11 which does not satisfy `>=2``` | host library too old (or the constraint too new) | upgrade the library or loosen the range; the lock fails instead of linking a wrong version |
system library `z` not found | neither pkg-config nor ldconfig -p knows the library | install the development package |
native pin `x` matches no native dependency in scope | typo in the root native table | correct the name or remove the pin |
| `` source mismatch for package `z``` | lock was written with different preferences or pins | re-lock with the same flags (--prefer-system / --prefer-bundled) |
task `bindgen` is reserved | tasks.bindgen collides with the driver | declare bindgen: { ... } instead |
task cycle: a -> b -> a | tasks invoke each other in a loop | break the cycle |
task `x`: step `...` failed with exit code N | a shell step failed (serial stop halts; continue reports at the end) | fix the command, or split it out of the critical path |
| `` nothing to push: no bindgen outputs and no files under `.rnx-cache/publish/``` | the pipeline has no inputs | declare bindgen.outputs or stage per-target blobs, then retry |
--artifact asserts X, the pipeline pushed Y | hand-copied digest disagrees with the fresh push | drop the flag and let the pipeline capture the digest |
`` pipeline: staged file ... must live at `.rnx-cache/publish/ | a staged file is outside the layout | move it under the target/role/title path |
artifact push failed ... | the OCI endpoint rejected a blob, manifest, or index PUT | check RNX_OCI_PUSH_URL, the token, and the repo name |
Containment warnings (W202)
| Code | Severity | Cause | Resolution |
|---|---|---|---|
W202 | warning | unsafe block that reaches no foreign call and no raw-memory operation | remove the unsafe block or move a foreign call into it |
W202 is the companion to the containment rule: an unsafe block must justify itself by containing (or calling into) foreign or raw-memory authority. rnx check also prints the containment boundary (one boundary: line per tainted function naming its direct seed count and whether every seed is contained), so audits can review the perimeter without reading every call site.
Performance notes and warnings (P101-P203)
The optimizer reports what it did to loop nests, and where it held back. These diagnostics never fail a build on their own. Warnings print to stderr on rnx build next to the timing table; notes (P101/P102) stay hidden unless rnx build --show-perf-notes (or RNX_SHOW_PERF_NOTES=1 when the flag is absent) asks for them.
| Code | Severity | Cause | Resolution |
|---|---|---|---|
P101 | note | a reduction nest was restructured to accumulation form | none; the compiler already did the work |
P102 | note | bounds checks in a loop were versioned behind a hoisted guard | none; the fast path runs unchecked |
P201 | warning | a reduction nest kept scalar order for one named reason (aliasing, unproven zero-fill, cost gate, or index roles) | fix the named proof; see the hint |
P202 | warning | a linear scan runs inside an outer loop (confidently quadratic at the stated trip product) | hoist the scan or precompute a lookup table; see the hint |
P203 | warning | a string is rebuilt by concatenation on every loop iteration, or an array is reallocated inside the loop and then grown (trip of 16 or more, accumulator live after the loop) | collect pieces with push and join once after the loop, or hoist the creation before the loop; see the hint |
#[Allow(PerfP201)] on a function silences P-diagnostics inside it, #[Allow(PerfAll)] silences all of them, and #![Allow(...)] at the top of a file silences the whole file. #[Allow(PerfP202)] works the same way for scan warnings. rnx build --deny-perf-lints (bare for all, or --deny-perf-lints=P201,P202,P203, repeatable; RNX_DENY_PERF_LINTS sets the same list when the flag is absent) promotes P-warnings to build failures for CI. Notes are never promoted, even with --show-perf-notes.
Automatic fixes (--fix)
rnx build --fix applies the compiler's own proven rewrite for the one qualifying case: a P201 ZeroInit failure becomes a zero-fill plus the accumulation form the optimizer then handles (verified by the P101 receipt appearing after the edit). Every other shape (aliasing, cost-gate and role failures, P202 scans, P203 accumulators) is refused with no autofix available; those need human judgment. The engine previews a diff, edits span-precisely (formatting outside the edit is byte-preserved), writes in place with a .bak backup per file (refused when a backup already exists unless --fix-force; --fix-keep-backup retains it), then re-parses, rebuilds, and compares program output against the pre-fix binary. Any step failing restores the file byte-for-byte and exits non-zero; files are applied all-or-nothing, fail-fast across files. Combining --fix with --deny-perf-lints on the same lint is an error: fix first, deny second.
Lint rules (L001-L005)
rnx lint reports these as warning[L00N] findings; --deny-warnings promotes them to build failures for CI.
| Code | Meaning |
|---|---|
L001 | let/const never read (_ prefix silences) |
L002 | function or method parameter never used (_ prefix or empty trait methods exempt) |
L003 | statements after return, throw, break, or continue |
L004 | pub fn/class/struct/trait/enum without /** */ docs |
L005 | empty {} in if, while, defer, try, or unsafe blocks |
Summary
- Every diagnostic is code plus sentence plus
▲pointer plus fix note; codes are stable and CI-matchable. - Errors fail the build, warnings advise, fatals report runtime stops.
rnx explain <code>, editor hovers, andrnx check --jsonexpose the same registry to humans and scripts.explaincovers everyE,W,S, andPcode; theL001-L005lint rules below are documented in their table and fixed per row rather than throughexplain.