GALA Compiler Error Codes

Every semantic error the GALA transpiler emits carries a stable error code of the form GALA-Exxxx. Codes are opaque identifiers — they never change meaning across releases, so tools, tests, CI checks, and documentation can link against them.

If the compiler handed you a code, find it in the table below and jump straight to the page for it.


Anatomy of a GALA error

gala build, gala run, and gala transpile print a framed diagnostic:

error[GALA-E0002]: non-exhaustive match: missing cases: Blue
  --> main.gala:10:5
   |
10 |     case Red()   => "red"
   |     ^^^^ add the missing variant cases, or add a `case _ => ...` defa…
   |
   = hint: add the missing variant cases, or add a `case _ => ...` default to cover them
Part Meaning
error[GALA-E0002] The stable code. Search it here, or grep for it in CI output.
header text What invariant was violated.
--> main.gala:10:5 File, line, and column of the offending token.
^^^ The span of the offending token, with a condensed hint beside it.
= hint: … The full remediation hint. Not every code emits one.

Diagnostics raised before a source position is known — package resolution and the type-inference engine — print the header and hint with no frame.

Batch analysis and your editor show the same diagnostic in a terse single-line form, because the language server consumes that shape:

Error transpiling main.gala: [SemanticError GALA-E0002] main.gala:10:4 non-exhaustive match: missing cases: Blue (hint: add the missing variant cases, or add a `case _ => ...` default to cover them)

Same code, same message; the column is zero-based in the terse form. See Compiler DX for more on the diagnostic renderer.


All error codes

Code What it means Category
GALA-E0001 Recursive Immutable[T] wrap Immutability
GALA-E0002 Non-exhaustive match on a sealed type Pattern matching
GALA-E0003 Match expression missing a default case Pattern matching
GALA-E0004 Sealed variant pattern binds the wrong number of fields Pattern matching
GALA-E0005 Extractor has no Unapply method Pattern matching
GALA-E0006 Multiple default cases in one match Pattern matching
GALA-E0007 Slice literal []T{…} is not a GALA construct Collections
GALA-E0008 Map literal map[K]V{…} is not a GALA construct Collections
GALA-E0009 Unrecognized pattern syntax (transpiler bug) Internal
GALA-E0010 Sibling .gala files declare different package names Packages
GALA-E0011 Type redefined in the same package Declarations
GALA-E0012 Method redefined on the same type Declarations
GALA-E0013 Non-defaulted parameter follows a defaulted one Declarations
GALA-E0014 Default value type does not match the parameter type Declarations
GALA-E0015 Bare return inside a value-producing match Pattern matching
GALA-E0017 Internal transpiler panic Internal
GALA-E0018 Cannot infer the type parameter of a sealed variant constructor Type inference
GALA-E0019 Empty parenthesized expression () used as a value Expressions
GALA-E0020 Package not found Packages
GALA-E0023 Undefined variable Type inference
GALA-E0025 Unresolved cross-package symbol (missing import) Packages
GALA-E0026 Ambiguous sealed-variant reference across dot imports Packages
GALA-E0027 Top-level function redeclared in the same package Declarations
GALA-E0028 Type alias redeclared in the same package Declarations
GALA-E0029 Interface lists two method specs with the same name Declarations
GALA-E0030 Struct declares two fields with the same name Declarations
GALA-E0031 Sealed type lists two cases with the same name Declarations
GALA-E0032 Two dot-imported packages export the same identifier Packages
GALA-E0033 Lambda parameter has no type and none can be inferred Type inference
GALA-E0034 Function/struct parameter has no declared type Declarations
GALA-E0035 Bare Go builtin (len, append, panic, …) called as a function Go surface
GALA-E0036 Bare Go statement keyword (defer, go, select, …) Go surface
GALA-E0037 Non-shareable value crosses a goroutine boundary Concurrency safety
GALA-E0038 Invalid escape sequence in a string literal Literals
GALA-E0039 Bare variant name in a match pattern Pattern matching
GALA-E0040 Go slice or map type in an expression Go surface
GALA-E0041 Import of an internal package from outside its tree Packages
GALA-E0042 Lambda parameter is not parenthesized Syntax
GALA-E0043 Type name called as a constructor Collections
GALA-E0044 Type has no such method Types
GALA-E0045 Missing required field in struct construction Declarations
GALA-E0046 Package already imported Packages
GALA-E0047 if takes no initializer statement Go surface
GALA-E0048 Method on an alias to a non-local type Declarations
GALA-E0049 A Go call’s Try or Tuple used as its plain value Types
GALA-E0050 Codec field type has no encoding Types
GALA-E0051 Illegal character in source (invalid UTF-8, NUL, stray byte order mark) Literals
GALA-E0052 Function declared inside a function body Declarations
GALA-E0053 Pointer method on a copy of a value that must not be copied Immutability
GALA-E0054 Value called as a function Types
GALA-E0055 Go keyword used as a name Go surface
GALA-E0056 Malformed tuple destructuring Declarations
GALA-E0057 Validate method with the wrong signature on a struct a codec decodes Types
GALA-E0058 Generated codec metadata named in GALA code Types
GALA-E0059 break or continue cannot reach its loop Control flow
GALA-E0060 val _ = binds nothing Declarations
GALA-E0061 Sealed variant used as a type Types
GALA-E0062 Opaque type over a type it cannot be declared over Types
GALA-E0063 Direct conversion between two opaque types Types
GALA-E0064 Opaque type used without a conversion Types
GALA-E0065 Opaque-type pattern with the wrong number of sub-patterns Types
GALA-E0066 Declaration collides with a dot import Declarations
GALA-E0067 Type argument cannot be inferred Types
GALA-E0068 Match or if-expression value has no type Type inference
GALA-E0069 return in a match or if-expression whose value is used Control flow
GALA-E0071 Invalid alternative pattern Pattern matching
GALA-E0072 Sealed variant with too many fields Pattern matching
GALA-E0073 Invalid named sub-pattern Pattern matching
GALA-E0074 Invalid default case Sealed types
GALA-E0075 No default value Types
GALA-E0076 Address of an immutable value Immutability
GALA-E0077 Type holds itself by value Types
GALA-E0078 Invalid interface literal Declarations
GALA-E0079 Invalid sealed-view match Pattern matching
GALA-E0080 Pointer that may be nil where a Ptr is needed Types
GALA-E0081 Field and method of one name Declarations
GALA-E0082 Wrong number of arguments Declarations
GALA-E0083 Unexported method of another package Sealed types
GALA-E0084 Values that cannot be compared with == Types
GALA-E0085 Struct tag on a field Go surface

Every code the compiler can emit now has a page. Codes are never renumbered and never change meaning, so a code you find in an old build log still means the same thing here.

Five codes are retired, and their numbers are not reused. GALA-E0016 rejected a generic struct field named like another generic type of its package, such as struct Box[T any](Mode Mode[T]); such fields are accepted now. GALA-E0070 rejected the read-only ConstPtr that &x of a val used to produce where an interface was expected; taking that address is now GALA-E0076. GALA-E0021, GALA-E0022 and GALA-E0024 belonged to a Hindley-Milner fallback engine that was removed; none of them ever reached a user.


Codes you will not see in practice

Three codes exist in the compiler but no valid source reaches them. Each still has a page, because a stable code is worth documenting even when it is a backstop:

Code Why you will not see it
GALA-E0009 Fires only if the grammar and the pattern transformer disagree — a transpiler bug.
GALA-E0017 A recovered panic inside the transformer — a transpiler bug.
GALA-E0026 Its precondition is a strict subset of GALA-E0032’s, which is checked first.

Everyday type mismatches transpile cleanly and surface from the Go compiler afterwards, pointing back at your .gala line. GALA’s inference deliberately leaves type checking to Go.


By category

Pattern matching and sealed types — E0002, E0003, E0004, E0005, E0006, E0015, E0018, E0031, E0039 bare variant name, E0061 a variant used as a type, E0071 an alternative pattern that binds a name, E0072 a variant with more than 10 fields, E0073 a malformed named sub-pattern, E0074 an invalid default case, E0079 a case that does not apply to a sealed view, E0083 a sealed type’s private is<Variant> predicate called from another package. Start with Pattern Matching and Sealed Types.

Collections and Go interop — E0007, E0008, E0043 type name called as a constructor, E0049 a Go call’s Try or Tuple used as its plain value, E0067 a type argument nothing determines, often a Go package whose types were not loaded, E0080 a pointer that may be nil where a non-null Ptr is needed. See Collections and Go Interop.

Declarations — E0011, E0012, E0013, E0014, E0034, E0045 missing required struct field, E0048 method on an alias to a non-local type, E0052 named function inside a body, E0056 malformed tuple destructuring, E0060 val _ = that binds nothing, E0066 a declaration named like a dot-imported name, E0077 a type that holds itself by value, E0078 an invalid interface literal, E0081 a struct field and method of one name, E0082 a call with the wrong number of arguments.

Redeclaration — one name declared twice: E0011 types · E0012 methods · E0027 functions · E0028 type aliases · E0029 interface method specs · E0030 struct fields · E0031 sealed cases. GALA has no overloading, so a second declaration is always a mistake.

Type inference — E0018, E0023, E0033, E0044 unknown method on a known type, E0054 a value that is not a function called as one, E0068 a match or if-expression whose value is used but has no type, E0084 == on values Go cannot compare. See Type Inference.

Opaque types — E0062 an underlying type that is not a scalar · E0063 a direct conversion between two opaque types · E0064 an implicit conversion to or from an opaque type · E0065 an opaque-type pattern with other than one sub-pattern. Start with Opaque Types.

Packages and imports — E0010, E0020, E0025, E0026, E0032, E0041 internal-package visibility, E0046 duplicate import. See Dependency Management.

Go constructs with no GALA surface — E0007 slice literals · E0008 map literals · E0035 builtins like len and panic · E0036 statement keywords like defer and go · E0040 slice/map types in an expression · E0047 the if initializer statement · E0055 a Go keyword used as a name · E0085 a struct tag on a field. Each names its GALA replacement or the fix.

Literals — E0038 invalid string escape · E0051 illegal source character · E0019 empty () used as a value.

Syntax — E0042 unparenthesized lambda parameter (x => e); GALA always writes (x) => e.

Control flow — E0015 bare return in a match whose value is used · E0059 break or continue that cannot reach its loop (outside a loop, in a lambda, or in a match or if-expression whose value is used) · E0069 a return that would leave only a match or if-expression whose value is used.

Immutability and concurrency safety — E0001, E0037, E0053 pointer method on a copy of a lock or builder · E0076 the address of a val, a parameter or a receiver. See Immutability and Concurrency Safety.

Transpiler bugs — E0009, E0017. These mean the transpiler hit a case it does not handle; please file an issue with the source snippet.


Further Reading