Error codes

E0331: await on something that is not a task

In a terminal: auk explain E0331 prints this page.

On this page

await waits for an async fn call, a task, or a tuple or list of them. This value is a plain value that is already available, so there is nothing to wait for.

Wrong#

auk
fn get(): int = 1
fn main() { print(await get()) }

Fixed#

auk
fn get(): int = 1
fn main() { print(get()) }

Common causes#

  • await on a normal (non-async) function: remove it, or make the function async fn.
  • Awaiting a value twice.

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