Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · Diagnostic codes

Docs

Diagnostic codes

Every problem xo check reports has a stable code. A code never changes meaning; new problems get new codes. xo check --json reports them as JSON with notes and machine applicable fixes, and xo explain <code> prints the explanation below in a terminal.

CodeSeverityPhaseMeaning
XO0101errorcheckername breaks the enforced naming rules (core 1.5)
XO0110errorcheckerunused local binding or import (core 3.1)
XO0150errorlexercharacter that cannot start any token
XO0151errorlexerstring, raw string, bytes, or triple quoted string not closed
XO0152errorlexerrune literal that is empty, unterminated, or holds more than one character
XO0153errorlexerunknown or malformed escape sequence
XO0154errorlexerbad digit, misplaced _, missing digits, or out of range integer
XO0155errorlexerunknown duration unit, fractional or non decimal duration
XO0156errorlexer${ without a matching } in the same string
XO0157errorlexer${} with no expression
XO0158errorlexeruse not followed by a valid import path
XO0160errorparser, checkera token that does not fit the grammar here; the checker reports a struct literal’s field written name alone or its .., or a list literal’s .., which only a destructuring assignment’s target takes (decision 0538)
XO0161errorparserlist element followed by a newline instead of a comma (core 1.3)
XO0162errorparserelse must be on the line of the closing brace (core 1.3)
XO0163errorparserunparenthesized struct literal in a condition (core 1.4)
XO0164errorparser(, [, or { not closed before end of file
XO0165errorparsersyntax that is not a pattern (core 3.5)
XO0166errorparserwhile cond used as an expression; only while { } is one
XO0167errorparsertop level declaration (fn, struct, const, …) inside a block
XO0168errorparserstatement (let, expression, …) at top level
XO0169errorparsermatch or select arms separated by , instead of newlines
XO0170errorparser, checkerseveral effects in a function type must be parenthesized (core 15); the checker reports it inside type arguments, where only the arity tells a second effect from a type argument (decision 0438)
XO0171errorparser.. used more than once or not last in pattern fields
XO0172errorparserfunction declaration without a body
XO0173errorparseruse after the first declaration (core 15: File)
XO0174errorparserbare self parameter outside an interface method signature
XO0175errorparsertwo statements or arms on one line
XO0176errorparserpub before something that cannot be exported
XO0177errorparsersyntax from another language (Go, Rust, TypeScript, Python, Swift, Kotlin); names the habit and the Xo form (decision 0087)
XO0178errorparsera line starts with a binary operator (||, &&, +, ==, …); end the previous line with it (core 1.3, decision 0136)
XO0179errorparserretired, never reported; was: var with a tuple or list pattern; decision 0384 allows var PATTERN = e (the code stays reserved)
XO0201errorcheckerResult value is never used (core 2.6)
XO0202errorcheckererror type does not convert to the enclosing error type (core 2.6)
XO0203errorcheckersuccess of a Result typed T must be written Ok(x) (core 2.6)
XO0204errorchecker? on an Option in a function returning a Result (core 2.5)
XO0205errorchecker? where the enclosing function cannot return the failure (core 2.5, 2.6)
XO0206errorcheckerlet _ = discards a Result; use .ignore_err("reason") (core 2.6)
XO0207warningvetmethod chain on the right of ?? starts at a literal, so it applies only to the default (core 15 precedence)
XO0208notevet.ignore_err("reason") discards an error; listed with its reason for review (core 2.6)
XO0209errorcheckeran expression statement discards the result of a call that only computes it, such as xs.reverse() (core 2.6)
XO0301errorcheckermatch does not cover every case (core 2.3)
XO0302errorcheckerpattern does not fit the type of the matched value (core 3.5)
XO0303errorcheckerrefutable pattern where an irrefutable one is required (core 3.5), and an assignment’s list target other than [..] (core 5.2, decision 0538)
XO0304errorcheckeralternatives of an or pattern bind different names or types (core 3.5)
XO0305warningchecker_ arm hides variants of an enum declared in this module (core 3.5)
XO0401errorcheckervalue of the wrong type; only three implicit conversions exist (core 2.10)
XO0402errorcheckertype arguments cannot be inferred (core 2.7)
XO0403errorcheckerwrong arguments or fields: count, names, missing, or duplicates
XO0404errorcheckertype does not implement a required interface or constraint (core 2.4)
XO0405errorcheckertype cannot be inferred here; annotate it
XO0406errorcheckeroperator, index, slice, or iteration not defined for the type
XO0407errorcheckername used as the wrong kind of thing (a type as a value, a value that is not callable)
XO0408errorcheckera block const initializer is not a compile time value (core 3.1)
XO0409errorcheckerinvalid explicit conversion (core 2.1)
XO0410errorcheckerreading a Map by index; use get or get_or_fault (core 3.6)
XO0411errorcheckertwo fields have one wire key under a derive the struct has (core 2.2, decision 0277)
XO0412errorcheckerempty wire name, as "" (core 2.2)
XO0413errorcheckerunknown derive argument or case: or match: value, or an argument on a derive that takes none (core 2.2)
XO0414warningcheckera wire name on a struct with no derive that maps fields to keys (core 2.2)
XO0415errorcheckera top-level constant’s initializer performs an effect (core 3.1, decision 0332)
XO0416errorcheckera constant’s value holds a handle (Mutex, Chan, Atomic, Task, a file) (core 3.1, decision 0332)
XO0420errorcheckerconstant std/time layout is invalid: unknown field, bad field form, or stray brace (std.md 13.3)
XO0421errorcheckerinteger literal does not fit the integer type it takes in context (1.6)
XO0422errorcheckerunknown or repeated wire name option; the options are omitempty and string (core 2.2, decisions 0309, 0555); for derive Proto, a bad field number, a repeated number or an unknown option (decision 0530)
XO0423errorcheckera field has two wire strings for one format (json "a" json "b") (core 2.2, decision 0315)
XO0424errorcheckera format’s wire string (json, sql, xml) on a struct that does not derive that format (core 2.2, decision 0315)
XO0425errorcheckera field type, a type parameter list, or a nested struct that derive Xml cannot map (core 2.9, decision 0315)
XO0426errorcheckera bad xml wire string: an unknown or unsupported option, attr with a path, chardata or attr on a type that cannot hold it (core 2.9, decision 0315)
XO0427errorcheckerxml.encode_value or xml.decode of a type parameter instead of a concrete struct (core 2.9, decision 0315)
XO0428errorcheckertwo variants of a valued enum have the same value (core 2.3, decision 0269)
XO0429errorcheckeran invalid valued enum: a value type other than Int or Str, a value on an enum with no value type, a variant with fields, type parameters, or a value that is not a constant of the value type (core 2.3, decision 0269)
XO0430errorcheckera pattern name spelled like a constant (upper case) that is neither a const in scope nor a variant: a misspelled constant pattern (core 3.5, decision 0269)
XO0431errorcheckera variant of an internally tagged enum (derive Json(tag: "type") without content:) whose payload is not an object: one field that is not a struct (core 2.3, decision 0478)
XO0432errorcheckerderive Json(via: P, to: f, from: g) whose to: or from: names no non generic, non method function of the type’s module (core 2.3, decision 0478)
XO0433errorcheckera mistyped to: or from: of derive Json(via: ...): to must be fn(T) -> P with no error, from fn(P) -> T ! E with E implementing Display (core 2.3, decision 0478)
XO0434errorcheckera variant with fields in a valued enum that is not its catch-all: the catch-all is the last variant, with one field of the value type and no value (core 2.3, decision 0493)
XO0435errorcheckera valued enum’s catch-all built from a constant that a named variant has (StorageClass.Unknown("STANDARD")): a second spelling of that variant, unequal to it (core 2.3, decision 0493)
XO0436errorcheckerfor over a type with next() whose ? does not match it: for x in v where next() can fail (write for x? in v), for x? in v where it cannot or over a builtin iteration, or a next() that does not return T? (core 3.5, decision 0494)
XO0437errorcheckerthe string wire option on a field that is not a Bool, integer, float or Str, or an Option of one (core 2.2, decision 0555)
XO0438warningcheckeran argument of a log.debug, log.info, log.warn or log.error call (or a Logger’s) performs an effect other than log; it runs only when the record is at or above the configured level (decision 0558, std.md 6)
XO0501errorcheckervar method called on a non var binding (core 3.4)
XO0502errorcheckerassignment to an immutable binding, to a captured variable, or to an element of Bytes (core 5.2, 3.3)
XO0503errorcheckerone variable or overlapping places passed to two var parameters of one call (core 5.2, decision 0111)
XO0510errorcheckeruse of a moved Buf, StrBuilder, BytesBuilder, or std move only handle (core 5.3)
XO0520errorcheckermutation of a copied or stored collection element is never written back (core 5.2)
XO0530warningvetbinding the payload of a field shares every heap field of a large value (decision 0263)
XO0531warningveta large parameter is only stored while each caller passes its last use, so its heap fields are shared and dropped again (decision 0263)
XO0532noteveta Map value read into a var, changed, and stored back; Map.update does it in one lookup (decision 0266)
XO0534noteveta task captures a value with many heap fields (32 or more), sharing each at the spawn (core 5.1, decision 0294)
XO0535notevet${x.debug()} in a string, which ${x:?} writes shorter; its fix rewrites it (core 1.6, decision 0296)
XO0536noteveta collection copied out of a list element, changed, and stored back, so its first change copies all of it; change the element in place (core 5.1, decision 0294)
XO0537warningvetretired, never reported; was: a by value receiver read before an argument that changes it; decision 0326 defines that order, so the check is gone (the code stays reserved)
XO0538warningveta var local written after a closure that reads it was created and before the closure is used: the closure keeps the value from its creation (core 5.1)
XO0539errorcheckera destructuring assignment names the same place twice (core 5.2, decision 0536)
XO0540warningcheckera Mutex.with closure writes its var value, then a path returns Err, which undoes the write (core 5.4)
XO0541warningveta slice of a raw.bytes_buf buffer that a loop reads into again is kept past the iteration (pushed, stored outside the loop, returned) without .clone(): the next read changes it (decision 0330 views)
XO0542warningvetx ?? lit <op> z: an operator binding tighter than ?? after a literal default applies only to the default (x ?? (lit <op> z)); (x ?? lit) <op> z is likely meant (core 15 precedence)
XO0601errorcheckername does not resolve (core 4.3)
XO0602errorcheckerimport path does not yield a valid local name (core 4.1)
XO0603errorcheckername declared twice in one scope, or a predeclared name redefined (core 3.1, 1.4)
XO0604errorcheckercyclic package imports (core 4.1)
XO0605errorcheckername is not pub in its module, a field of a std struct documented @internal outside std (decision 0440), or the std type is an opaque handle (core 1.5)
XO0606errorcheckermethod declared outside the module of its type (core 3.4)
XO0607errorcheckerbreak or continue outside a loop, or an unknown label (core 3.5)
XO0608errorcheckertwo C ABI export modules of the native std (std/native/llrt/cabi*.xo) define the same function name, one symbol xo_x_<name> (decision 0207)
XO0609errorcheckera merged std module calls an intrinsic of native/rt that is not portable (decision 0597: only rt.cast)
XO0701errorcheckereffect performed outside the declared set (core 6.2)
XO0702errorcheckerunknown effect label (core 6.1)
XO0703warningveteffect declared in uses is never performed (core 6.2)
XO0801errorcheckerchild or group task error does not convert to the enclosing error type (core 7.1)
XO0802errorcheckerscope handle, or a value containing a task group, escapes its scope (core 7.1)
XO0803errorcheckertask started without a scope handle (core 7.1)
XO0804warningcheckervalue read in one Mutex.with is written back in a later one (core 5.4)
XO0900warningcheckertyped hole report (core 3.7)
XO0901warningvetdbg(...) left in code (core 11.4)
XO0902warningvettls.Verify.None: a TLS client that checks no certificate (std.md 27, decision 0281)
XO0903warningvetthe error of a filesystem, network, or process call turned into a default (.ok() ?? d, or Err(_) => <empty> with no NotFound arm), so a transient error gives a smaller answer instead of an error; // xo:allow XO0903 <reason> on the line or above it allows one
XO0906noteveta match that only unwraps an Option or a Result or leaves, which x ?? return v (r ?? e => return v) writes in one line (core 2.5, 2.6, decision 0321)
XO0907notevet –costa loop that copies every entry of a map before it starts (a log-mode map through a forked view, or a body the in-place walk does not take; decision 0327)
XO0908notevet –costin a loop, an element of a collection made outside it is counted up and down each iteration (passed to a function value whose result has its type, which takes it), or a prelude method hands each element holding heap memory to such a function value (map, filter, find, any, all, fold of a List, Map, or Set; decisions 0327, 0337)
XO0909notevet –costa list update in a loop that copies the whole list every iteration: the list is also kept in the same iteration (stored, captured, or a name used after the update), so it is shared when the update runs (decision 0327)
XO0910notevet –costa value over 8 words copied where the source shows no copy: captured by a closure, or, in a loop, an element of a collection wrapped whole in an Option or enum value (decision 0327)
XO0911notevet –costa view of a parameter’s text or bytes (a slice, trim or cut made in a loop, or an element of its split or lines) stored in a field or a returned collection keeps the whole input alive; clone() it (decision 0330)
XO0912warningvetretired in 0.34.0 (no longer reported): u.0, the pattern uuid.Uuid(p), or uuid.Uuid(s) on a uuid.Uuid was deprecated in 0.33.0; a uuid.Uuid is now two Ints and those uses are type errors (std.md 24, decision 0387)
XO0913notevet –costin a loop, a slice of a Str or Bytes read only by index, length or equality: each iteration makes a view (a range check, a count and a drop); read the whole by offsets (knowledgebase/std-performance-guide.md)
XO0914notevet –costin a loop, a List of at most 8 elements made and only filled and read in the iteration: an allocation and a free every iteration; keep the values in locals or reuse one list made before the loop (knowledgebase/std-performance-guide.md)
XO0915warningvet –costa raw address (raw.data, raw.bytes_addr, rt.obj_addr, std internals) used after its value was released in the same block: a value is released at its last use, even inside the arguments of the call that takes its address, so the call reads freed memory; keep it alive with raw.alive or raw.alive_str after the last access (gotchas/raw-address-outlives-bytes.md)
XO0916warningvettime.format or time.parse called with a layout that is a compile time string (a literal, a constant, or a + of them): each call parses the layout text again (5.4 and 4.7 of Go’s wall), where a const Layout made with time.layout is parsed once (2.0 and 1.9); a layout built at run time is not reported, and // xo:allow XO0916 REASON silences a cold call (decision 0464)
XO0917warningveta valued enum’s catch-all built directly from a run time value (StorageClass.Unknown(s)): a value a named variant has would become a second spelling of it; E.from(s) picks the named variant (decision 0493)
XO0904warningveta file an embed constant embeds is ignored or untracked by git, so a build of a clean checkout embeds something else or fails (decision 0304)
XO1001errorreservedstd/sys/<os> used outside the matching target arm (core 12.2)
XO1101errorcheckerGo package cannot be bound (not found, does not build, main package, or binding error)
XO1102errorcheckerGo name exists but its signature does not map to Xo, so the binding skipped it
XO1103notevetper module report of use go packages and the functions that perform go (decision 0041)
XO1104errorcheckerC header cannot be bound (not found, clang cannot read it, a link file is missing, or an unknown effect in its uses)
XO1105errorcheckerC function exists in the header but its signature does not map to Xo, so the binding skipped it
XO1106errorcheckera value with no Go value passed to Go as any: go.any(x)’s argument or an element of a list literal for a ...any parameter (decision 0412)
XO1107warningcheckera List, Map or Set given to a Go function as any (go.any(xs) for an any parameter, or an element of a ...any list): Go receives a copy, so a change it makes is not seen; not for a function compiler/check/goreads.xo lists as only reading, nor with // xo:allow XO1107 <reason> (core 4.4, decision 0491)
XO1201errorno GC check, checker (use c without --no-gc)construct, std API, or effect not available on the native backends (arm64, amd64, LLVM); planned or impossible
XO1301errormodulesmalformed xo.mod require or deny line, xo.lock, or xo.work line, or a deny rule naming a package that does not exist (core 4.2, 4.3)
XO1302errormodulesmodule version cannot be fetched from git or a module proxy (XO_PROXY): repository, tag, or version missing, or its xo.mod declares another path
XO1303errormodulesmodule version is not in the module cache and the build is offline (XO_OFFLINE, –offline)
XO1304errormodulesmodule tree does not match its xo.lock content hash (core 4.3)
XO1305errormodulesxo.lock has no hash for a module version the build uses; run xo mod tidy
XO1306errorcheckerimport of a package from a module that xo.mod does not require
XO1307errormodulesvendor/ does not match xo.mod; run xo vendor
XO1308errorbuildrelease build (xo build --release, or --ci) while an xo.work workspace overrides required modules
XO1309errorcheckercall into a dependency performs an effect above its ceiling (require ... uses ... in xo.mod, use ... uses ... in xo.work)
XO1310errorpublishxo publish: a minor or patch release removes or changes an export, or adds an effect to one
XO1311errorpublishxo publish: the release cannot be made (not in a git repository, a subdirectory module path not ending in its directory, uncommitted changes, tag exists, version not above the last, wrong /vN path)
XO1312errorcheckeruse of a package that a deny rule of xo.mod forbids (decision 0095)
XO1313errormodulesa fetched module version disagrees with the checksum log (XO_SUMDB), or the log’s signature or proofs do not verify (4.3, decision 0124)
XO1314errormodulesthe checksum log cannot be consulted, or XO_PROXY, XO_SUMDB, XO_NOPROXY, or XO_NOSUMDB is malformed (4.2, decisions 0124, 0126)
XO1315notecheckeredition 2026 in xo.mod (or xo 2026 in xo.work) is the old name of edition preview; the fix rewrites it (13, decision 0155)
XO1316errorchecker, xo getuse c or use go of an impure Go package in a required module without the consumer’s vouch for that version (4.2, decision 0156)
XO1317errormodulesa dependency’s effects are wider than its effects line in xo.lock (4.3, decision 0156)
XO1318errormodulesa module’s tree cannot be read (an I/O error) for its content hash, the effect or escape hatch audit, or xo mod tidy’s import scan, so none of them answers from a partial tree (4.3, decision 0156)
XO1319errormodulesa use go of a package outside Go’s standard library whose Go module has no require go line in xo.mod (builds would follow its latest version); the fix adds the line with the version the binding resolved, and xo mod tidy adds it too (decision 0356)
XO1320errormodulesxo mod tidy with a require go pin whose go.sum hashes no binding has fetched yet (a fresh clone: .xo/gobind is not committed) and xo.lock does not hold: nothing is written; run xo check once, then tidy again (decision 0356)
XO1401errorcheckerallocation in a real-time function (literal, interpolation, + on Str or List, closure, growth method)
XO1402errorcheckerloop without a provable bound in a real-time function, or a bound N that is not a constant or is exceeded by a constant range
XO1403errorcheckercall in a real-time function of a function that is not real-time, a function value, or an interface method
XO1404errorcheckerrecursion among real-time functions
XO1405errorcheckerblocking operation (channel, Mutex, scope, select, task) or capability effect in a real-time function
XO1501errorbuild--stamp NAME=VALUE names no const NAME: Str = "..." (a plain string literal) of the main module (decision 0165)
XO1502errorbuildthe go command the Go backend runs ($XO_GO, else go on PATH) is older than Go 1.24, the oldest Go that builds generated programs and the runtime (decision 0176)
XO1503errorbuildthe Go backend finds no go command: $XO_GO is not an executable file, or there is no go on PATH; the native backends need none (decision 0176)
XO1504errorbuildthe program uses a std API the native runtime does not support on the build’s target yet: reported by no build since stage 2 of decision 0197 (2026-10-12; stage 1 left out processes on Windows), and Windows builds default to the amd64 backend (decisions 0254, 0270); the message would name them, and the Go backend builds the program
XO1505errorbuildthe LLVM backend’s clang ($XO_CLANG, else clang, or --cc) is an LLVM clang older than 16, whose LLVM lacks llvm.threadlocal.address; Apple’s clang (numbered apart) is not checked (gotchas/llvm-thread-local-constant.md)
XO1506errorcheckerembed("...") names no file, more than one for a Str or Bytes constant, a file that cannot be read, or more than an embed may hold (64 MiB each, 256 MiB a program; decision 0304)
XO1507errorcheckeran embed path leaves the module: absolute, .., ., an empty segment, or a symbolic link (decision 0304)
XO1508errorcheckera Str embed constant’s file is not valid UTF-8; declare it Bytes (decision 0304)
XO1509errorcheckerembed used other than as the initializer of a constant typed Str, Bytes, or embed.Dir, with one plain string literal (decision 0304)
XO1510errorbuilda function the native backends are about to generate disagrees with this build’s definitions: a call’s argument or result types, a closure, or a field or payload access do not match the callee or type (decision 0342: a stale cached piece, such as a front end body naming a helper this build defines otherwise, or, when it repeats with the cache off, a code generator bug such as a call resolved to the wrong method); rebuild with XO_BACKEND_CACHE=off and report it
XO1511warningcheckerread, read_text, or contains on an embed.Dir constant, or a literal .sub of one, with a literal path it holds no file at; a key ending in the path is offered as a fix (decision 0304)
XO1512errorbuildunder XO_BACKEND_CACHE=verify, a build, run, or test the run cache would have served differs from its rebuild, in the binary or in what the build printed: an input the entry does not list, or a build that is not reproducible (decision 0360)
XO1513errorbuilda command the WASI build of xo (xo built for wasip1/wasm) does not offer: it needs a process, a socket or a system tool that WASI preview1 does not have (run, test, serve, get, build --backend=llvm, …); printed as xo: COMMAND is not available in the WASI build, exit status 2 (decision 0405)
XO1514errorbuilda program that calls http.serve_component built for wasip1/wasm, which --backend=wasm alone is; it builds with --targets=wasip2/wasm (decision 0447)
XO1515errorbuilda program built for wasip2/wasm reaches what its world does not have: processes, or files or sockets in a wasi:http component (a command has wasi:filesystem since 2026-11-02 and wasi:sockets since 2026-11-03); the message names the call and how it is reached (decision 0447); on wasip3/wasm also a program that is not a wasi:http component (stage 5)
XO1516errorbuilda program built for wasip2/wasm whose main never calls http.serve_component (decision 0447); no longer reported since stage 3 (2026-11-02), when such a program became a wasi:cli/command component
XO1517errorbuilda windows program’s resource input that cannot be used: the --versioninfo JSON cannot be read or parsed, an --icon file cannot be read or is not an icon, a --manifest file cannot be read; the message carries goversioninfo’s text (decision 0560)
XO1518errorcheckera function’s as c "name" clause breaks a C export rule: a method, not pub fn, generic, a var parameter, a Bool or function type parameter, more than 8 integer parameter words, a Bytes, Str, Bool or function type result, a name that is not a C identifier or starts with xo_ (decision 0574)