Diagnostics

Every diagnostic has a stable code, so it can be configured, suppressed and searched for. Codes never change meaning; retired codes are not reused.

Last updated Invalid DateVersion 1.0.0

Every diagnostic has a stable code, so it can be configured, suppressed and searched for. Codes never change meaning; retired codes are not reused.

PrefixSeverityMeaning
Eerrorblocks compilation and hot reload
Wwarninga likely bug
Pperfa likely performance problem
Hhintstyle or simplification

Code ranges

RangeOwnerStatus
E0001–E0019lexerimplemented (wave 1)
E0020–E0049parserimplemented (wave 2)
E0050–E0069manifests, modules, packagesimplemented (wave 3)
E0070diagnostic suppressionimplemented (wave 5)
E0101–E0119types and name resolutionimplemented (wave 4)
E0117–E0119sizes, cyclic declarations, parametersimplemented (wave 5)
E0120–E0126memory, references, conversions, receivers, genericsE0120 (wave 5), E0123–E0124 (waves 8–9), E0125 (wave 10), E0126 (wave 11)
E0127–E0129systems and the access graphall wave 11
E0130a module-level declaration with no type writtenwave 12
E0137weak fields and module-level weak varsD207, D253
E0143, E0144module-qualified namesD246
E0145self stored from its own deinitD229
E0147, E0148what crosses a threadD232
E0150, E0151, E0152an offered function that does not state its errors, an error outside a stated set, an error with data in a bare T!D235
E0153, E0154a bodiless uses unsafe that should be unsafe fun, an unsafe fun that overrides or implements a safe methodD236
E0155a @Hot function that allocates, directly or through what it callsD237
E0156, E0157Self outside a type, an ability that takes Self used as a valueD239
E0159retired: an after delay that is not a number is E0101D243, D260
E0160an @Operator ability that is not one operator-shaped methodD239
E0161, E0162a borrowed function value in a place that keeps it, an escaping closure that takes a reference, pointer, slice or borrowed functionD240
E0163a function held in a variable, handed to a @Thread functionD252, D275
E0164a script class that derives from an extern classD256
E0165an element written through a slice that is not []mut TD251
E0175, E0176@Save on something that is not a stored field of a class or a struct, a saved field of a type std.save cannot writeD266
E0178, E0179a replication attribute where it means nothing, a replicated field or an RPC that carries a type a host cannot sendD268

| E0166 | an arm of a match on a T! that names no error in scope | D275 |

| E0149 | an owning field moved out of the value that holds it | D233 | | E0201 | pattern matching | implemented (wave 4) | | E0301–E0305 | suspension and tasks | implemented (wave 10) | | E0401–E0403 | inheritance, abilities, bounds | implemented (waves 4–5) | | E05xx | entities and systems | wave 11 | | E06xx | networking | wave 16 | | E0701–E0705 | effects, determinism, capabilities | implemented (wave 5, E0705 in D217) | | E0801 | forbidden unsafe | implemented (wave 5) | | E09xx | compile-time evaluation | wave 7 | | E10xx | units and dimensions | implemented (wave 4) | | W0101–W0102 | unused names, unreachable code | implemented (wave 5) | | W01xx | the rest of the warnings | waves 6+ |

Implemented: lexical errors

CodeMessageExample
E0001unterminated string literal"abc
E0002unknown escape sequence"a\qb"
E0003invalid character literal'', 'ab', 'a
E0004malformed number literal0x, 0b1012, 0o18
E0005unexpected character$
E0006invalid UTF-8 encodinga stray 0xFF byte
E0007unterminated or empty interpolation"{}", "{health"
E0008integer literal does not fit in 64 bits18446744073709551616
E0009invalid Unicode escape"\u41", "\u{110000}", "\u{D800}"
E0010invalid numeric suffix1f128, 1.5u8, 0xFFm
E0011reserved word used as an identifierconst transactional = 1
E0012unterminated block comment/* with no */
E0013code point cannot appear in an identifierconst 🚀 = 1
E0014identifier is not in Unicode NFC formи plus a combining breve

Lexing never stops at the first problem: a malformed token is reported, flagged with TokenFlags::kHasError, and replaced with the best recovery value, so one broken literal does not hide the structure of the rest of the file. A run of characters the lexer cannot start a token with is reported once, not once per character.

Implemented: syntax errors

CodeMessageExample
E0020expected a declaration42 at file scope
E0021expected an identifierfun 1() {}
E0022expected a specific tokenclass C without {
E0023expected a typefun f(a: ) {}
E0024expected an expressionconst a = *
E0025expected a patternfor in items {}
E0026unmatched delimitera block without its }
E0028expected a blockfun f() ???
E0029duplicate modifierpub offer fun f() {}
E0034expected a match armmatch v { => 1 }
E0035expected a state declarationa fn inside a machine
E0036expected a transitiona stray name inside a state
E0037expected a unit definitionunit m with no dimension
E0040expected a line break between statementsconst a = 1 const b = 2
E0041nesting too deephundreds of nested parentheses, or a chain of a thousand +1 (D225)
E0042unknown type parameter in a where clausefun f<T>() where U: A {}
E0043unexpected token after an expression"{a b}"
E0044no enclosing loop carries that labelbreak nowhere
E0045expected an array length[]int
E0046keep anywhere but on the function type of a parameter (D240)class C { var f: keep fun() }

E0026 carries two labels: the primary one where the closing delimiter was expected, and a secondary one on the delimiter that was left open.

Parsing never stops either. An unparsable construct becomes an error node, the parser resynchronizes on the next declaration, statement or closing brace, and the declarations around the broken one still reach the tree. The parser also suppresses its own message when the offending token was already reported by the lexer, or when the attributes and modifiers in front of a declaration already produced one, so each broken spot yields one diagnostic.

Implemented: package and module errors

CodeMessageExample
E0050manifest syntax errora line without =, an unclosed table header
E0051unknown manifest key or tableauthor = "me" under [package]
E0052missing manifest keyno [package], no name, a dependency without a path
E0053invalid manifest value, a version requirement that is malformed or that the copy found does not meet, or a bare-string dependency (D242)name = p, version = "^x", core = "1.2"
E0054duplicate manifest keyname given twice in one table
E0055unresolved moduleneed game.nowhere
E0056a needed name is not declaredneed game.math.{Vec4} when there is no Vec4
E0057name declared more than once in a moduletwo files declaring fun Fire
E0058a needed name is not offeredneeding a declaration without offer
E0059cyclic package dependenciestwo packages depending on each other
E0060package cannot be readno manifest, no source directory, unreadable file, a bad memory package (D293)

A manifest problem never stops the load: the manifest keeps whatever was understood, so one bad line does not hide the rest of a project. A file checked on its own, outside any package, resolves no imports and reports none of E0055–E0058 — compiling a single file is a legitimate thing to do.

Per-code severity comes from the [lints] table of the package that owns the file, including "off" to silence a code entirely:

Text
[lints]
W0105 = "off"
P0101 = "error"

Implemented: warnings

CodeMessageExample
W0101a name is never usedan unused local, parameter or need
W0102this code is never reacheda statement after return
W0109a state nothing leads tostate Stuck with no transition to it

A name starting with _ is never reported, which is how an unused parameter is marked deliberate. A declaration with no body — an ability method, an extern — has nowhere to use its parameters, so it is exempt. W0102 is reported once per block rather than once per statement after the jump.

A machine is a table, so it is checked as one: E0206 for a transition to a state that is not there, and W0109 for a state nothing leads to. Both are mistakes somebody makes while editing a table, which is why the spec asks for them.

An unused need is checked by the type checker rather than by import resolution, because only type checking knows what a file actually named. A bare need a.b brings in a whole module, so there is no one name to call unused.

Implemented: effects and capabilities

CodeMessageExample
E0701a declaration does an effect it does not statefun f() uses io whose body reaches rand
E0702this context forbids the effect@Deterministic reaching rand
E0703the package was not granted the capabilityuses net under capabilities = "io"
E0704an offered signature does not state its effectsoffer fun f() whose body does io
E0705a sandboxed package declares externextern class wolang { fun system(...) } in a mod
E0801unsafe where the package forbids itunsafe { } under unsafe = "deny"
E0301wait outside a task functionfun f() { wait g() }
E0302a task called without wait or spawnfun f() { g() } where g is a task
E0303wait is not the whole of its expressionconst x = n + wait f()
E0304a task waits on itselftask fun f() { wait f() }
E0305wait on a task from another modulewait other.Work()
E0802a type with no C representation crosses the extern boundaryextern "C" fun f(s: text)
E0803an extern function has a bodyextern "C" fun f() { }

A row is inferred inside a module and stated on offered signatures. A declaration that states nothing is not contradicted, but its inferred row still reaches its callers — the exception is offer, because inference stops at the module boundary and a caller elsewhere has nothing else to read.

E0702 outranks a signature: declaring an effect does not make it allowed in a context that forbids it. E0703 is not a mistake in the code but a permission the package was not given, which is the distinction that makes mod sandboxing explainable.

Suppression

wolang
@allow(W0101, reason = "kept for the ABI")
fun Legacy(unused: int) {}

@allow applies to one declaration and everything inside it, takes several codes, and requires a reason — a suppression without one is how a codebase forgets why it stopped checking something. A missing reason is E0070; the codes are still honoured while the author fixes the attribute, so the lint they named does not reappear on top of the complaint.

Per-code severity from the manifest's [lints] table still applies, and "off" there silences a code for a whole package.

Implemented: type errors

CodeMessageExample
E0101mismatched typesconst x: bool = 1; an int is s64, so xs.len or an int passed to an s32 parameter needs as s32
E0102wrong number of argumentscalling a two-parameter function with one
E0103no value with that name is in scopeconst x = nothing_here
E0104a value that may be absent was used directlyp.field where p: Pawn?
E0105assignment to a const binding, or a const array handed to a []mut T parameter (D275)const a = 1 then a = 2
E0106the callee is not callablecalling an integer
E0107the value cannot be indexedn[0] where n: int
E0108an operator got the wrong kind of operand-s where s: text
E0109the literal does not fit its typeconst x: u8 = 300; with no type, from 2^63 (int is s64)
E0110no type with that name is in scopefun f(a: Nothing)
E0111the name is not a typea function used in type position
E0112the type has no such memberv.z where Vec3 has x and y
E0117a value type contains itself, so it has no sizestruct S { var next: S }, enum E { X(e: E) }, struct W<T> { var w: W<W<T>>? }
E0118a declaration is defined in terms of itselftype A = A, class A : A, dimension D = D
E0119a type parameter is declared twicefun f<T, T>()
E0113the name is declared twice in one file
E0114no dimension with that nameunit m: Nothing
E0115a unit conversion needs a literal with a unitunit cm = 5
E0116a dimension is a product of dimension namesdimension D = 2 + 2
E1001dimensions do not match10m + 2s
E1002no unit with that name is in scope10parsecs
E0201match does not cover every valuea bool match with only true
E0402an ability method is not implementedextend P as T missing one method
E0403a type argument does not satisfy a boundHurt(rock) where T: Damageable
E0401override disagrees with the base methodmarked override with nothing to override
E0120a field holds a referencevar r: &int
E0137weak on something that is not a C? field of a class or a module-level varweak var count: int
E0138a type outside an ability with nothing after ittype Count
E0139an extern class constructed, or given something other than methodsActor()
E0143a name two needed modules both offer is used bare (D246)need json and need ini, then Parse(text)
E0144module.Name where the module offers no such name, or does not offer it; also in a match pattern (D246)json.Nothing(x)
E0145self stored into a field or global from its own deinitdeinit { stash = self }
E0147a function or closure given to a @Thread parameter (Spawn, ParallelFor) reads or writes a module-level var, directly or through a call or a method, in any module, and the caller does not state uses unsafe; a callee that states it stops the walk (D232, D252)Spawn(Work) where Work pushes to a global list
E0148a closure that captures given to a @Thread parameter that has no environment to give it (Spawn; not ParallelFor), even under uses unsafe (D232)Spawn(|| { Print("{n}") })
E0101after <delay> where the delay is not a number or a quantity: the generated Tick(dt) counts seconds up to it (D260; E0159 is retired)on Interact after "soon" -> Closed
E0150an offer fun whose result is a bare T!: a caller in another module cannot see which errors it holds, so the set is written (D235)offer fun F() -> int!
E0151an error returned, or passed on with ?, that the stated set does not contain; or a ? from a bare T! into a stated set (D235)fun F() -> int!(A) { return B }
E0152an error that carries data where the result is a bare T!, which has no room for it; name it in the set (D235)fun F() -> int! { return P(1) } with error P(x: int)
E0153a function with no body that writes uses unsafe: nothing vouches for it, so it is the caller's promise; write unsafe fun (D236)fun Free(items: []u8) uses unsafe
E0154an unsafe fun that overrides a method, or implements an ability method, that is not unsafe: a call through the base would skip the promise (D236)override unsafe fun F() {} over virtual fun F() {}
E0155a @Hot function that constructs a class, builds owned text, takes storage with ArrayNew/SoaNew, builds an error with data, or calls something that does; the note lists the calls (D237)@Hot fun Tick() { Grow() } with fun Grow() { const b = Box() }
E0158a name in a uses clause that is no effect: a typo, or alloc, which is not one any more (D237)fun F() uses alloc {}
E0156Self where there is no type for it to be: outside an ability, an extend and a type's own body (D239)fun F(x: Self)
E0157an ability whose method names Self used as the type of a value; use it as a bound instead (D239)const e: Eq = a, fun F(e: Eq)
E0161a function value from a parameter that is not keep stored, returned, or given to a keep parameter, field or kept local (D240)fun Hold(f: fun()) { saved = f }
E0162a closure that outlives its call taking a reference, a pointer, a slice or a borrowed function with it (D240)fun M(r: &int) -> fun() -> int { return || r }
E0175@Save on a method, a derived or weak field, a host class's member, or anything that is not a stored field of a class or a struct (D266)class Mover { @Save fun Step() {} }
E0176a @Save field whose type std.save cannot write back: an array, a slice, a function, a class with a virtual method, an enum that carries values, a struct holding one of these (D266)class Mover { @Save var cells: [4]int }
E0178@Replicated, @Server, @Client or @Multicast on a member of a struct, on a free function, on the wrong kind of member (a field for an RPC attribute, a method for @Replicated), two of them on one member, or an argument the attribute does not take (D268)struct S { @Replicated var n: int }
E0179a replicated field or an RPC parameter a host cannot send (an object reference, an array, a struct that holds one), or an RPC that returns a value (D268)class P { @Server fun Fire() -> int => 1 }
E0165an element written, or &mut taken of one, through a slice that is []T and not []mut T; a write through a handle the slice holds is not one (D251)fun Fill(xs: []int) { xs[0] = 1 }
E0163a local that holds a function, handed to a @Thread function: the checker cannot follow it to the globals it reaches, so the caller must pass the function by name or as a closure, state uses unsafe, or be @Thread itself and pass on what it was given (D252, D275)@Thread fun Launch(body: fun()) {} then fun Go(f: fun()) { Launch(f) }
E0164a script class with an extern class as its base: no host object stands behind it, and an upcast would hand the host a pointer it never made (D256)extern class A {} then class B : A {}
E0166a pattern in a match on a T! that is not Ok and names no error in scope: a typo, or an error that was not imported with need (D275)match Parse(s) { Ok(v) => v Gone(x) => x _ => 0 }
E0160an @Operator ability that is not exactly one method named Plus, Minus, Times, Divide, Negate, Equals or Compare with that operator's shape (D239)@Operator ability A { fun Frob(o: Self) -> Self }

| E0149 | a value with a deinit taken out of a field of the struct or enum that owns it (D233) | Take(o.r) where o: Outer holds r: Res |

| E0149 | a value with a deinit taken out of a field of the struct or enum that owns it, or moved on from inside a closure that captured it (D233) | Take(o.r) where o: Outer holds r: Res | | E0140 | a generic instantiates itself with ever bigger types | fun F<T>(x: T) { F([x]) } (D225) | | E0121 | a reference would outlive what it points into (also through fields, indices, calls and a local array as a slice, D228) | return &local.n | | E0142 | an object made inside arena { } is stored outside, returned or given out as the block's value (D228) | kept = Leaf(1) inside the block, kept declared outside | | E0122 | a value that was moved out of is used again | const b = a then Take(a) where a: Text | | E0123 | a variable is used before anything is written to it | var x: int then return x | | E0124 | the conversion is not between numbers | s as int where s: text | | E0125 | a method of a value type assigns to a field of self | struct P { fun F() { x = 1 } } | | E0126 | a generic type built with nothing to bind its parameter | struct M<T> { var tag: int } then M(1) | | E0127 | two systems use the same component, one writes it, and nothing says which runs first | two systems over Query<mut Velocity> | | E0128 | @After or @Before names something that is not a system | @After(Grabity) | | E0129 | the orderings between systems form a cycle | @After(B) on A and @After(A) on B | | E0130 | a module-level const or var with no type written | const five = 5 at file scope | | E0131 | a for over something that cannot be walked | for x in 5 | | E0132 | a function with a declared result can reach its end without returning one | fun F() -> int { 42 } | | E0133 | a type parameter appears nowhere in a signature, so no call can say what it is | fun F<T>(n: int) -> bool | | E0134 | a closure parameter whose type nothing says | const f = \|n\| n + 1 | | E0135 | a closure naming a local of the function around it | const k = 1 then \|n\| n + k | | E0070 | @allow is missing a code or a reason | @allow(W0101) |

An error type propagates silently: one unknown name produces one message, not one per use of the value it was assigned to. Type checking is also skipped entirely on a file the parser could not finish, because every type inferred around an error node is noise.

E0201 names what is missing rather than only saying the match is incomplete — the uncovered enum variants, or true/false, or null/x?. Only bool, optionals and enums have a value set the compiler can enumerate; every other type needs a catch-all arm. An arm with a guard covers nothing, because the guard may be false.

E0303, E0304 and E0305 are the shape of the transform showing through, and each says so rather than pretending otherwise. A task is split into a state machine whose frame holds everything that outlives a suspension, so: a wait has to be the whole of its expression, because anything else in that expression would be a value the frame has nowhere to keep; a task cannot wait on itself, because its frame would contain itself; and a wait on a task from another module needs the frame layout that module computed, which lowering -- one file at a time -- does not have. The first will relax when the transform spills values of its own; the last when there is a whole-program step, the same one cross-file monomorphization needs.

Suspension is both a word and an effect. wait is where a function suspends and task is how a signature says it may, which keeps the suspension point visible at the call site; async in the effect row is what makes it checkable, so a comptime or @Hot context forbids suspending with the same machinery that forbids allocating. task counts as stating the effect, so nobody writes it twice. spawn starts work without waiting for it: everything the task does carries over to the spawner -- starting work is being responsible for it -- except async, because the spawner does not suspend.

Calling an extern function is the unsafe effect, which is how every rule already in place applies to the FFI with nothing new to write: a declaration that calls out has to state uses unsafe when it is offered, a @Deterministic context cannot reach C, and a package with unsafe = "deny" cannot call out at all (E0801). The one thing the FFI adds is E0802: the C boundary takes numbers, bool and pointers, because everything crossing it has to mean the same on both sides, and a type whose layout this compiler decides unilaterally — a slice, a string, an optional — does not.

E0121 is the escape rule for a second-class reference (D8): a reference may be passed inwards and never kept somewhere that outlives it. Two scopes can be failed to outlive -- a arena, whose value leaves it, and the call frame, which a return leaves.

E0122 is the other half of the same walk. A type that owns a resource -- today a Text, later an Owned<T> -- cannot be in two places, so handing it somewhere moves it and the name it was in no longer holds a value. Which use moves and which merely borrows is the question "what did the context want": a Text where a Text is expected moves, and a Text where a text is expected is the implicit borrow of D15b. A write gives the name a value again. Writes merge by intersection and moves by union: a value moved on one branch is gone at the join, while a value written on one branch is not written. A loop body is walked twice, because the second iteration moving what the first one moved is the mistake worth reporting.

A deferred statement is analysed where it is written rather than where it runs, so a defer that uses something moved after it is not reported. The alternative is to analyse the deferred statement at every exit, which is what lowering already does with it; the check will follow when defer has a reason to be part of the move rules.

E0123 is definite assignment: a variable is reported when any path to a use fails to write it, which is why a loop body does not count -- it may not run. It is also what makes the two execution tiers agree, because the interpreter traps on reading a slot nothing wrote and compiled code reads the zero its prologue left. A variable is initialized as a whole: writing one field of an uninitialized struct is still a use of the struct.

as converts between numbers and does nothing else. It exists because D33 removed implicit widening, not as a reinterpretation of bits -- so a narrowing conversion that would change the value traps, the same way an overflowing add does, and converting anything that is not a number is E0124 rather than a cast that quietly means something.

E0125 is the difference between a value and a handle, reported where it would otherwise be invisible. A method of a struct is passed a copy of the object, so assigning to a field of self would change the copy and nothing else; a method of a class is passed the handle, so the same line changes the object. Before the receiver existed at all this compiled to nothing -- which is the kind of silence a diagnostic exists to replace.

A type whose members are not known — declared in a file this one cannot see — yields an error type without an E0112, because the unresolved import is already reported and one cause should produce one message.

E0117 is about storage, not about recursion: a value type stores its members inline, so struct S { var next: S } describes something of infinite size, and so do S?, [4]S and (int, S) inside it. One indirection is enough to have a size — a slice, a reference, or a class, which is a handle to a heap object.

Planned catalog

The entries below are specified but not implemented. They are listed here so that codes are allocated once and tests can be written against the catalog rather than against whatever the implementation happens to do. Codes already in use appear in the implemented tables above, not here.

Errors

CodeCatches
E0501reserved, unused: implemented as E0127
E0502reserved, unused: ordering errors are E0127 and E0128
E0601server-only function called from a client context
E0602RPC parameter type is not serializable
E0901comptime assertion failed
E0902comptime evaluation needs an effect

Warnings

CodeCatches
W0103local variable shadows a field
W0104ignored result of a @MustUse function
W0105floats compared with ==
W0106overflow or division by zero in a constant expression
W0107reference held across an wait
W0108loop in a task function with a path that never waits
W0109(code taken by the unreachable-state warning above; needs a new code) signal subscription that outlives the subscriber
W0110replicated field written on a client
W0111self used after Destroy()
W0112recursion with no base case
W0113weak reference dereferenced without a liveness check
W0115reserved; the unreachable-state check is implemented as W0109

Performance

CodeCatches
P0101heap allocation in a hot path
P0102string concatenation in a hot path
P0103lookup that should be cached in a field
P0104loop-invariant expensive call
P0105quadratic iteration over all entities
P0106large struct passed by value
P0107foreach could not be vectorized, with the reason
P0108virtual call in a hot loop that cannot be devirtualized
P0109bounds check not eliminated, with the reason
P0110coroutine that waits every frame

Hints

CodeCatches
H0101var never reassigned, use const
H0102did you mean a similarly spelled name
H0103null check that could be ?.
H0104redundant explicit type
H0105unit conversion that could be written with a unit literal

Rendering

Diagnostics are rendered with the source line, markers under the relevant spans, notes and machine-applicable fixes:

Text
warning[W0107]: actor reference `t` held across `wait`
 --> combat/turret.wo:3:3
  |
2 |   const t = target
  |       - `t` captured here
3 |   wait Wait(0.5s)
  |   ^^^^^^^^^^^^^^^^ `t` may be destroyed while waiting
  |
  = note: re-check liveness after the wait

Primary spans are marked with ^, secondary spans with -, and a span that continues past the end of its line ends with .... Tabs are expanded so markers line up, and multi-byte characters count as one column. Labels pointing into other files are reported as notes rather than being dropped.

Configuration

Per-code severity can be overridden, including to off, through DiagnosticEngine::SetSeverityOverride. From wave 3 this is driven by the package manifest, and by @allow(code, reason = "...") in source, where the reason is mandatory. See Suppression above.

Page feedback

Was this page helpful?