Vitte Errors

This page is the stable reference for common diagnostics and fixes.

Layer map:

  • parse: syntax and structure checks.
  • resolve: name, type, import and declaration checks.
  • IR: lowering and intermediate representation checks.
  • backend: Code generation and toolchain checks.

Each diagnosis follows the same structure:

  • Code
  • Symptom
  • Probable cause
  • Correction
  • Example
  • See also
## E0001 - expected identifier
  • Code: E0001
  • Layer: parse
  • Symptom: The parser was expecting a variable, type, module, or declaration name.
  • Probable cause: a declaration is missing its identifier, or the token after a keyword is not a valid name.
  • Fix: Add a valid identifier where the parser indicates.
  • Example:
proc main() -> i32 { return 0 }
## E0002 - expected expression
  • Code: E0002
  • Layer: parse
  • Symptom: The parser was expecting an expression at this location.
  • Probable cause: A value, call, or block expression is missing after a keyword or operator.
  • Fix: provide an expression like 1, name, call() or { ... }.
  • Example:
let x = 1
## E0003 - expected pattern
  • Code: E0003
  • Layer: parse
  • Symptom: The parser was expecting a pattern.
  • Probable cause: A construct when or similar to match received an incomplete pattern.
  • Fix: use a pattern as an identifier or constructor, for example Some(x).
  • Example:
when x is Option.Some { return 0 }
## E0004 - expected type
  • Code: E0004
  • Layer: parse
  • Symptom: The parser was expecting a type name.
  • Probable cause: A type annotation is present, but the right member is missing or malformed.
  • Fix: Use a built-in type or a named type, for example int or Option[T].
  • Example:
proc id(x: int) -> int { return x }
## E0005 - `end` expected
  • Code: E0005
  • Layer: parse
  • Symptom: A block was opened but not closed with end or .end.
  • Probable cause: a proc, form or pick block is missing its terminator.
  • Fix: Add missing terminator for open construct.
  • Example:
form Point
  field x as int
.end
## E0006 - `proc` expected after attribute
  • Code: E0006
  • Layer: parse
  • Symptom: An attribute must be followed by an proc declaration.
  • Probable cause: the attribute is hooked to the wrong element or is alone.
  • Fix: Place the attribute directly above a proc.
  • Example:
#[inline]
proc add(a: int, b: int) -> int { return a + b }
## E0007 - top-level declaration expected
  • Code: E0007
  • Layer: parse
  • Symptom: The parser was expecting a top-level declaration.
  • Probable cause: An element appears at the root of the file, but it is not one of the supported declarations.
  • Correction: limit the top-level to space, use, form, pick, type, const, proc and entry.
  • Example:
space my/app
proc main() -> int { return 0 }
## E0008 - duplicate pattern binding
  • Code: E0008
  • Layer: parse
  • Symptom: A pattern has linked the same name more than once.
  • Probable cause: The pattern reuses a binding in two places.
  • Fix: give a separate name to each binding.
  • Example:
when Pair(x, x) { return 0 }
## E0009 - unknown type
  • Code: E0009
  • Layer: resolve
  • Symptom: A referenced type name was not found.
  • Probable cause: Type is misspelled or not imported.
  • Fix: check spelling or import type with use or pull.
  • Example:
use std/core/option.Option
proc f(x: Option[int]) -> int { return 0 }
## E0010 - unknown generic base type
  • Code: E0010
  • Layer: resolve
  • Symptom: The base type of a generic was not found.
  • Probable cause: Generic base type is misspelled or not imported.
  • Fix: check spelling or import base type with use or pull.
  • Example:
use std/core/option.Option
let x: Option[int] = Option.None
## E0011 - a generic type requires at least one argument
  • Code: E0011
  • Layer: resolve
  • Symptom: A generic type was written without a type argument.
  • Probable cause: Type application is incomplete.
  • Fix: provide one or more type arguments between [ ].
  • Example:
let x: Option = Option.None
## E0012 - unsupported type
  • Code: E0012
  • Layer: resolve
  • Symptom: This type form is not yet supported.
  • Probable cause: The type syntax is valid enough to be parsed, but the compiler does not yet accept this form.
  • Fix: Use a supported type form like built-in types, named types, pointers, slices or proc types.
  • Example:
let p: *int = &value
## E0013 - unknown identifier
  • Code: E0013
  • Layer: resolve
  • Symptom: A referenced name was not found in the current scope.
  • Probable cause: The symbol is misspelled, out of scope, or not imported.
  • Correction: check the spelling or import it from a module with use or pull.
  • Example:
use std/bridge/print
proc main() -> int { print("hi"); return 0 }
## E0014 - summon without callee
  • Code: E0014
  • Layer: parse
  • Symptom: A summon has no callee.
  • Probable cause: The calling expression starts with arguments instead of a function or proc name.
  • Fix: provide a function or proc name before arguments.
  • Example:
print("hi")
## E0015 - expression not supported in HIR
  • Code: E0015
  • Layer: IR
  • Symptom: This expression is not yet supported by HIR lowering.
  • Probable cause: The expression form achieves lowering, but the lowering path does not implement it yet.
  • Fix: Rewrite expression with supported constructors.
  • Example:
let x = value
## E0016 - pattern not supported in HIR
  • Code: E0016
  • Layer: IR
  • Symptom: This pattern is not yet supported by HIR lowering.
  • Probable cause: The pattern reaches lowering, but the lowering path does not implement it yet.
  • Fix: Rewrite pattern with supported constructors.
  • Example:
when x is Option.Some { return 0 }
## E0017 - instruction not supported in HIR
  • Code: E0017
  • Layer: IR
  • Symptom: This instruction is not yet supported by HIR lowering.
  • Probable cause: The statement form achieves lowering, but the lowering path does not implement it yet.
  • Fix: Rewrite the statement with supported constructors.
  • Example:
return 0
## E0018 - an external `proc` cannot have a body
  • Code: E0018
  • Layer: resolve
  • Symptom: An extern procedure cannot define a body.
  • Probable cause: #[extern] and a body were combined on the same proc.
  • Fix: remove body or remove #[extern] if you want to implement it here.
  • Example:
#[extern]
proc puts(s: string) -> int
## E0019 - a `proc` requires a body unless marked `#[extern]`
  • Code: E0019
  • Layer: resolve
  • Symptom: A procedure must have a body unless it is marked #[extern].
  • Probable cause: the declaration ends without a body or the extern marker is missing.
  • Fix: add body with { ... } or mark proc #[extern].
  • Example:
proc add(a: int, b: int) -> int { return a + b }
## E0020 - a type alias requires a target type
  • Code: E0020
  • Layer: resolve
  • Symptom: A type alias must specify a target type.
  • Probable cause: Alias ​​definition stops after name.
  • Fix: provide right side of alias.
  • Example:
type Size = int
## E0021 - a generic type requires at least one type argument
  • Code: E0021
  • Layer: resolve
  • Symptom: A generic type needs at least one type argument.
  • Probable cause: Generic application is empty.
  • Fix: provide type arguments between [ ].
  • Example:
let xs: List = List.empty()
## E0022 - unexpected HIR type shape
  • Code: E0022
  • Layer: IR
  • Symptom: The compiler encountered an unexpected HIR type shape.
  • Probable cause: lowering reached a type shape that is not handled correctly.
  • Fix: Try a simpler type and report the problem if it occurs again.
  • Example:
let x: int = 0
## E0023 - unexpected HIR expression form
  • Code: E0023
  • Layer: IR
  • Symptom: The compiler encountered an unexpected HIR expression form.
  • Probable cause: lowering has reached a form of expression that is not handled correctly.
  • Fix: try a simpler expression and report the problem if it occurs again.
  • Example:
let x = 1
## E0024 - `select` requires at least one `when` branch
  • Code: E0024
  • Layer: resolve
  • Symptom: An select instruction needs at least one when branch.
  • Probable cause: block select was opened but not populated with valid branches.
  • Correction: add a clause when and possibly otherwise.
  • Example:
select x
  when int(v) { return v }
otherwise { return 0 }
## E0025 - a `select` branch must be a `when` statement
  • Code: E0025
  • Layer: resolve
  • Symptom: Each select branch must be an when instruction.
  • Probable cause: A branch is using a form of instruction that is not allowed at this location.
  • Fix: replace branch with pattern when or use otherwise.
  • Example:
select x
  when int(v) { return v }
otherwise { return 0 }
## E0026 - unexpected HIR instruction form
  • Code: E0026
  • Layer: IR
  • Symptom: The compiler encountered an unexpected HIR instruction form.
  • Probable cause: Lowering encountered an instruction form that should not reach this path.
  • Fix: try a simpler instruction and report a compiler bug if it happens again.
  • Example:
return 0
## E0027 - unexpected HIR pattern shape
  • Code: E0027
  • Layer: IR
  • Symptom: The compiler encountered an unexpected HIR pattern shape.
  • Probable cause: Lowering encountered a pattern shape that should not reach this path.
  • Fix: try a simpler pattern and report a compiler bug if it happens again.
  • Example:
when x is Option.None { return 0 }
## E0028 - unexpected HIR declaration form
  • Code: E0028
  • Layer: IR
  • Symptom: The compiler encountered an unexpected form of HIR declaration.
  • Probable cause: Lowering encountered a declaration form that should not reach this path.
  • Fix: try a simpler declaration and report a compiler bug if it happens again.
  • Example:
proc main() -> int { return 0 }