Error codes

E0400: patterns don't cover every case

In a terminal: auk explain E0400 prints this page.

On this page

A match, or the clauses of a function, must handle every possible value. Auk checks this at compile time, so adding a variant to an enum points you at every place that must handle it. The message lists a value that no arm or clause handles.

Wrong#

auk
enum Shape { Circle(r: float), Rect(w: float, h: float) }
fn area(s: Shape): float = match s {
  Circle(r) => 3.14 * r * r
}

Fixed#

auk
enum Shape { Circle(r: float), Rect(w: float, h: float) }
fn area(s: Shape): float = match s {
  Circle(r) => 3.14 * r * r
  Rect(w, h) => w * h
}

Common causes#

  • A new enum variant not yet handled everywhere.
  • Arms with when guards: guarded arms don't count toward coverage; add an unguarded one.
  • none/err(_) forgotten when matching T?/T!.
  • Literal clauses like fib(0), fib(1) without a general fib(n: int) clause.

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page