本頁尚未翻譯,以下為英文原文。
# Error codes
本頁內容
Every nabic diagnostic starts with a code: error[E0040]: mismatched types: .... There is one code per kind of error, so one code covers many messages; the message itself says what is wrong and, usually, what to write instead. nabic --explain E0040 (or nabi --explain E0040) prints a short explanation of a code; its page here says the same and shows an example. With --message-format=json the code is the code field and its area the kind field (9.9.4 Diagnostics ).
Codes are numbered in the order they were added, from E0001 up with no gaps. This index describes nabic 0.1.0. Most pages show an example, checked against the real compiler output when the docs are built, and its fix.
# Lexical
Code Kind Title
E0001 lexicalunexpected character in source
E0002 lexicalbidirectional control character in source
E0003 lexicalmalformed numeric literal
E0004 lexicalliteral out of range for its type
E0005 lexicalunterminated literal or comment
E0006 lexicalinvalid escape in a literal
E0007 lexicala character literal holds one character
E0008 lexicalmalformed f-string
E0009 lexicalname cannot be a raw identifier
E0147 lexicalinvisible character in code
E0148 lexicalcharacter that only looks like a token
# Syntax
Code Kind Title
E0010 parseunexpected token
E0011 parsenesting too deep
E0012 parsesyntax from another language
E0013 parsestruct literal in a block head
E0014 parsemodifiers out of order
E0015 parsedoc comment documents nothing
E0016 parsevisibility where it has no meaning
E0017 parseitem in the wrong place
E0018 parsereturn with a value in top-level statements
E0019 parseoperators that need parentheses
E0020 parsereturn in a trailing closure
E0021 parsereserved word used as a name
E0022 parselet without a value
E0023 parseinvalid function signature
E0024 parseinvalid generic parameters
E0025 parseunsupported ABI
# Names and modules
Code Kind Title
E0026 resolvename defined more than once
E0027 resolvecannot find value or function
E0028 resolvecannot find type or trait
E0029 resolvecannot find enum variant
E0030 moduleunresolved import
E0031 resolveambiguous name
E0032 moduleconflicting imports
E0033 moduleinvalid re-export
E0034 visibilityitem is private
E0035 modulemodule file problem
E0036 moduleinvalid program entry point
E0037 moduleinvalid dependency
E0038 resolvevariable named like a nested function
E0039 resolvenested item uses an outer local
E0128 moduleinvalid WIT
E0135 resolvetrait of the method not in scope
E0141 resolvemethod generic parameter named like its impl's
# Types
Code Kind Title
E0040 typemismatched types
E0041 typebranches of different types
E0042 typetype annotations needed
E0043 typeno such field
E0044 typemissing field in a literal
E0045 typefield given more than once
E0046 typeno such method or associated item
E0047 typeitem used in the wrong form
E0048 typewrong number of arguments
E0049 typeinvalid named argument
E0050 typeref parameter and argument mismatch
E0051 typeinvalid spread argument
E0052 typevalue is not callable
E0053 typeinvalid cast
E0054 typeoperator cannot be applied
E0055 typeliteral fits several types
E0056 typeinvalid indexing
E0057 typeinvalid assignment
E0058 typeinvalid closure capture
E0059 typekeyword outside its context
E0060 typelet .. else that does not diverge
E0061 typeoperation needs unsafe
E0062 typeerror not handled
E0063 typethrown value is not an Error
E0064 typeoptional operator on a value that is not optional
E0065 typelock guard not released by using
E0066 typeusing on a value without Drop
E0067 typeblock statement leaves a value
E0068 typevalue cannot be iterated
E0069 typetrait bound not satisfied
E0070 typenot a trait
E0071 typetrait used as a type
E0072 typeimpl is missing a trait item
E0073 typeimpl item is not in the trait
E0074 typeimpl item does not match the trait
E0075 typeconflicting implementations
E0076 typeimpl of a foreign trait for a foreign type
E0077 typesupertrait not implemented
E0078 typeimpl not allowed
E0079 typecannot evaluate at compile time
E0080 typedefinition depends on itself
E0081 typeinvalid const generic argument
E0082 typewrong generic arguments
E0083 typeinvalid enum value
E0084 typeinvalid foreign-function use
E0085 typevalue cannot cross threads
E0086 typeinvalid union
E0087 typeambiguous associated item
E0088 typeinvalid format
E0089 typeinvalid compiler built-in call
E0090 typeinvalid coroutine use
E0091 typeinvalid broadcast
E0092 typeDrop::drop called directly
E0093 typegeneric instantiation too deep
E0094 typeinvalid representation
E0095 typetype too large
E0096 typetry or catch that does nothing
E0097 typeNABION value of the wrong shape
E0138 typepub function signature not written out
E0140 typeassignment to a value that is not a place
E0142 typerows of an array literal differ in length
E0143 typemulti-axis index on a type indexed along one axis
E0144 typeinteger raised to a negative power
E0145 typenamed some type not defined by its module
E0146 typenamed some type used as its concrete type
# Patterns
Code Kind Title
E0098 patternnon-exhaustive match
E0099 patternunreachable match arm
E0100 patternpattern does not fit the value's type
E0101 patternwrong number of fields in a pattern
E0102 patternor-pattern alternatives bind differently
E0103 patternbinding looks like a variant
E0104 patterninvalid rest pattern
# Hand-off and resources
Code Kind Title
E0105 handoffvalue used after it was handed over
E0106 handoffvalue used after its lock was released
E0107 handoffshared value handed over
E0133 handoffresource used after it was moved or closed
E0134 handoffresource not closed
E0136 handoffthread-local value kept past with
E0137 handofflist view used after a resize
E0139 handoffstream view used past its stream
Code Kind Title
E0108 metacannot derive
E0109 metamalformed attribute
E0110 metaattribute on the wrong item
E0111 metainvalid #[lang] item
E0112 metainvalid operator declaration
E0113 metainvalid #[keyword] declaration
E0114 metainvalid literal handler
E0115 metainvalid #[intrinsic]
E0116 metamalformed macro definition
E0117 metano macro rule matches
E0118 metainvalid meta template
E0119 metainvalid meta block
E0120 metarecursive expansion
E0121 metainvalid cfg predicate
E0122 metafile include failed
E0123 metaregistered twice
E0124 metameta name cannot be resolved
# Build and back end
Code Kind Title
E0125 othercannot read or write a file
E0126 linkagelink failed
E0127 linkageexternal tool failed
E0129 unsupportednot supported by this backend
E0130 internalinternal compiler error
E0132 otherinvalid compiler option
E0149 typechange a running program cannot take
# Lints
Code Kind Title
E0131 lintlint
Found a mistake? Edit this page on GitHub . Last updated 20 November 2026