Error codes

E0201: a T!/T? value used where a plain value is expected (missing ?)

In a terminal: auk explain E0201 prints this page.

On this page

The value may be an error (T!) or missing (T?), but a plain T is expected. Auk makes failure visible: decide what happens in the bad case with ? (pass it up), else (a fallback) or ! (panic).

Wrong#

auk
fn count(s: str): int! {
  let n: int = int.parse(s)
  n + 1
}

Fixed#

auk
fn count(s: str): int! {
  let n: int = int.parse(s)?
  n + 1
}

Common causes#

  • Calling a fallible function (fs.read, int.parse, xs.first()) without ? or else.
  • In a function that can't fail itself, use else: int.parse(s) else 0.

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