# Exit codes

Exit codes are part of the 1.0 stability promise.

| Code  | Meaning                                                                                     |
| ----- | ------------------------------------------------------------------------------------------- |
| `0`   | Success. For `wait`: the run is `idle`, `turn_completed`, or `completed`.                   |
| `1`   | Failure. For `wait`: the run `failed`, or its repository delivery failed.                   |
| `2`   | `wait` only: the run needs input (`needs_input`).                                           |
| `3`   | No authenticated model route or runtime credential.                                         |
| `124` | `wait` only: the timeout passed. The run is unchanged.                                      |
| `130` | Cancelled or interrupted. For `wait`: the run was `cancelled`, or the wait was interrupted. |

## Exit 3

Any command can return 3, including `run`, `resume`, `attach`, `send`, `smoke`, `build`, `create`, `connect`, and `outcome --recover`. It always comes with the missing piece and the command that fixes it, such as:

```text
No authenticated route is available for openai/gpt-5.6-terra. Run wb connect project-core --runtime docker, or pass the provider key for one run with --env-file.
```

`wait` reports such a run as `failed` and exits 1, because the run itself failed.

## Exit 2 and the supervision loop

A supervising script treats 2 as "answer something", not as an error:

```sh
wb wait "$session" --timeout 120 --json > result.json
case $? in
  0) echo "turn done or run complete" ;;
  2) echo "pending request: answer it with wb answer" ;;
  124) echo "still running: wait again" ;;
  *) echo "failed or cancelled" ;;
esac
```

## Errors before a run starts

Argument errors, preflight failures, authentication failures, and worker startup failures print `error: <message>` (a red `✗ <message>` in a terminal) on stderr, emit no events, and exit 1 or 3.
