Error Codes

Every Turbo compiler diagnostic includes a unique error code. Use turbo explain E0100 to look up any code from the command line.

$ turbo explain E0100
E0100: Type mismatch
  The compiler expected one type but found another.

Parse Errors (E0001--E0099)

CodeDescription
E0001Unexpected token during parsing
E0002Expected identifier
E0003Maximum nesting depth exceeded
E0004Invalid import syntax
E0005Invalid string interpolation syntax
E0006Unexpected end of file
E0007Invalid attribute
E0008Invalid expression

Type Errors (E0100--E0199)

CodeDescription
E0100Type mismatch
E0101Cannot perform arithmetic on non-numeric type
E0102Mismatched types in arithmetic operation
E0103Cannot compare incompatible types
E0104Expected bool in logical operation
E0105Cannot negate non-numeric type
E0106Cannot apply logical not to non-bool type
E0107If/else branches have different types
E0108Match arms have different types
E0109Function return type does not match body
E0110Type annotation does not match value type
E0111Cannot assign incompatible type to variable
E0112Cannot assign incompatible type to struct field
E0113Cannot assign incompatible type to array element
E0114Array elements must all have the same type
E0115Cannot infer type of empty array literal
E0116If condition must be bool
E0117While condition must be bool
E0118?? inner type does not match default type
E0119?? requires an optional type on the left
E0120? operator requires a Result type
E0121? can only be used in a function returning Result
E0122Range bounds must be integers
E0123Array index must be an integer
E0124Cannot index into non-array type
E0125Closure body type does not match declared return type
E0126Cannot infer type of closure parameter
E0127Unknown closure return type
E0128Struct equality requires @derive(Eq)
E0129Cannot use ordering comparison on struct type
E0130Incompatible type in compound assignment
E0131Type parameter inference conflict
E0132Pattern type incompatible with match subject
E0133Builtin function argument type mismatch
E0134Cannot call method on this type
E0135Cannot access field on this type
E0136Expression nesting too deep
E0137Unsupported compound assignment operator

Pattern/Match Errors (E0200--E0299)

CodeDescription
E0200Match expression is not exhaustive
E0201Match expression has no arms
E0202Match guard must be bool
E0203Variant destructure binding count does not match field count
E0204Enum variant requires arguments but none were provided

Name Resolution Errors (E0300--E0399)

CodeDescription
E0300Undefined variable
E0301Undefined function
E0302Undefined struct
E0303Undefined enum
E0304Undefined trait
E0305Unknown type name
E0306Struct is already defined
E0307Enum is already defined
E0308Function is already defined
E0309Trait is already defined
E0310Method is already defined for this type
E0311Constant is already defined
E0312Agent is already defined
E0313Cannot redefine builtin function
E0314No main function found
E0315Struct has no such field
E0316Enum has no such variant
E0317No such method found on type
E0318Missing field in struct literal
E0319Unknown derive trait
E0320Impl block for undefined type
E0321Undefined tool function referenced in agent
E0322Function referenced in agent is not a tool fn
E0323Unknown type in trait method signature
E0324Unknown return type

Codegen Errors (E0400--E0499)

CodeDescription
E0400Internal code generation error
E0401Undefined variable during code generation
E0402Undefined function during code generation
E0403Unsupported expression during code generation
E0404Linker or build tool error
E0405Cranelift backend error
E0406Missing function definition

Misc Errors (E0500--E0599)

CodeDescription
E0500Wrong number of arguments
E0501Cannot assign to immutable variable
E0502Cannot assign to field of immutable variable
E0503Cannot assign to index of immutable variable
E0504Test function must have no parameters
E0505Test function must have no return type
E0506Constant must be a literal value
E0507break can only be used inside a loop
E0508continue can only be used inside a loop
E0509Required trait method is not implemented
E0510Trait impl method return type does not match trait definition
E0511Agent does not accept field initializers
E0512Only named function calls are supported
E0513Builtin function argument count error