# Problem code `'handler-async'`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts`, `tables/problems.json` and `services/onsite-scripter/scripts/contract-docs-what-to-do.json` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

A member of [`ProblemCode`](../api/ProblemCode.md) · stable · since 2.0.0

An event handler returned a Promise (an untyped call); it was not awaited.

## What to do

A [`session.on`](../api/Session.on.md) handler must not return a Promise (an `async` handler is a type error): start the async work inside a plain handler, and catch it there.

```ts
session.on('committed', ({ patch }) => { void saveDraft(patch).catch(console.error); }, { signal });
```

## Where the declaration names it

- [`Events.problem`](../api/Events.problem.md): A 'handler-threw', 'handler-async' or 'handler-rejected' that a 'problem' handler caused, and any Problem of an operation it called, is recorded but fires no 'problem' event.
- [`Problem.event`](../api/Problem.event.md): The event name, for 'handler-threw', 'handler-async', 'handler-rejected' and 'unknown-event'.
- [`Session.on`](../api/Session.on.md): Errors: an unknown event records 'unknown-event' and returns a no-op unsubscribe; a handler that throws records 'handler-threw', one that returns a Promise 'handler-async', and that Promise's rejection 'handler-rejected'.

The set is open: handle a code you don't know (`'other'`).
