Xo is experimental. The source code is not public yet; it will be soon. Read the release notes
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
XO0160errorparsera token that does not fit the grammar here
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
XO0170errorparserseveral effects in a function type must be parenthesized (core 15)
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)
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)
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)
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)
XO0408errorcheckerconst 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)
XO0420errorcheckerconstant std/time layout is invalid: unknown field, bad field form, or stray brace (std.md 13.3)
XO0501errorcheckervar method called on a non var binding (core 3.4)
XO0502errorcheckerassignment to an immutable binding or to a captured variable (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, or BytesBuilder (core 5.3)
XO0520errorcheckermutation of a copied or stored collection element is never written back (core 5.2)
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 module imports (core 4.1)
XO0605errorcheckername is not pub in its module, 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)
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)
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
XO1201errorno GC check, checker (use c without --no-gc)construct, std API, or effect not available without a garbage collector (--no-gc); 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)
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