# Errors and limits

> Close codes, rejection reasons, timeouts and capacity.

Source: https://docs.joinin.ai/baton/v2/guides/errors-and-limits/ · Last updated 21 Oct 2026

## WebSocket close codes

| Code | Meaning | What to do |
|---|---|---|
| 1000 | Normal close: after `session.end`, or `idle_timeout` | Nothing. |
| 1008 | A message was rejected: `session.start` at the start, or `agent.speech` during the session. The reason says why. | Fix the message; don't retry unchanged. |
| 1013 | Temporarily unable to serve, at the start or during the session | Retry after a short delay, ideally with backoff. |

Reasons are short, fixed texts. Match on their start, not the whole string: the part after a list name or a parenthesis can change.

### 1008 reasons at the start

| Reason | Cause |
|---|---|
| `session.start must be a JSON object` | The first message is not text, not JSON, or not an object. |
| `invalid api key` | Missing or unknown key, or not a string. |
| `unknown mode (one of transactional_call, ...)` | `mode` is not a recognised value (or not a string). |
| `N bad language code(s)` | A code is malformed. |
| `N language code(s) not supported by this ASR` | A code is valid but not served. |
| `unknown language mode (only auto)` | `language.mode` is not `auto`. |
| `language must be an object` | `language` is not an object, e.g. `"en"` instead of `{"pin": "en"}`. |
| `language.allowed must be a list of codes` | `language.allowed` is not a list. |
| `eot must be an object` | `eot` is not an object. |
| `eot: give a profile or a latency_budget_ms, not both` | Both were given. |
| `unknown eot profile (N published: GET /v2/eot/profiles)` | The profile name doesn't exist. |
| `eot.latency_budget_ms must be a positive number` | Zero, negative or not a number. |
| `eot.action_delay_ms must be an integer from 0 to 5000` | Out of range, or not a whole number. |
| `eot.timeout_ms must be an integer from 500 to 15000` | Out of range, or not a whole number. |
| `eot.timeout_ms <n> is below eot.action_delay_ms <n> ...` | The timeout is shorter than the delay. |
| `signals must be a list of names` | `signals` is not a list of strings. |
| `unknown signal (one of vad, bargein, ...)` | A name in `signals` is not one this endpoint offers (`eot` is accepted and ignored). |
| `echo must be "on" or "off"` | `echo` is another value, or not a string. |
| `keywords must be an object of word lists` | `keywords` is not an object. |
| `keywords: unknown list` | A list name is not one Baton knows. |
| `keywords.<list> must be a list of at most 200 strings` | A list is not a list, or is too long. |
| `keywords.<list>: entry N must be a string of 1 to K words` | An entry is empty, not a string, or too long. |
| `idle_timeout_s must be a number of seconds` | `idle_timeout_s` is not a number. |
| `inference_interval must be a number from 0.02 to 1` | Out of range, or not a number. |
| `messages must be a list of at most 1000 objects` | `messages` is not a list of objects, or is too long. |
| `unsupported language '<code>'` | Rooms: the transcriber can't serve that language. This reason repeats your code. |

### 1008 reasons during the session

A text message that is not a JSON object, an audio frame that is not whole samples, or an `agent.speech` with a malformed field, closes the session with 1008:

| Reason | Cause |
|---|---|
| `control message must be a JSON object` | A text message is not JSON, or not an object. |
| `audio frame must be a source byte and 16-bit PCM` | The bytes after the source byte are an odd count, e.g. the source byte is missing. |
| `agent.speech text must be a string (at most 20000 chars)` | `text` |
| `agent.speech duration_s must be a number of seconds >= 0` | `duration_s` is negative, not a number, or over 3600. |
| `agent.speech words must be a list of {w, t0, t1}` | `words` is not a list, or has more than 5000 entries. |
| `agent.speech words: each must be {w: string, t0, t1} ...` | A word is malformed, or `t1` is before `t0`. |
| `agent.speech expect must be a list of 1-20 strings` | `expect` |
| `agent.speech expect: every candidate must be ...` | A candidate is not a string, or is not 1 to 4 words (at most 60 characters). |
| `agent.speech expect: a candidate has no letters or digits` |  |
| `agent.speech expect: 'none' is reserved ...` |  |
| `agent.speech expect: candidates must differ ...` | Two candidates are the same after ignoring case, punctuation and number spelling. |

### 1013 reasons

| Reason | When | Cause |
|---|---|---|
| `stream capacity reached on this instance; retry` | Start | Streams are at capacity. |
| `room capacity reached on this instance; retry` | Start | Rooms are at capacity. |
| `room ASR unavailable: <reason>` | Start | Room transcription is temporarily unavailable. |
| `falling behind real time on this instance; retry` | During the session | Baton fell more than 5 s behind your audio. Open a new session. |

## Timeouts

- **Idle sessions** on every `/v2` endpoint close after `idle_timeout_s` seconds without speech (default 600; 0 or less disables it). A `warning` with `code: "idle_timeout"` and `close_in_s` comes first, then a 1000 close with reason `idle_timeout`. Speech resets the timer.
- **Sessions** last at most one hour. This limit is the load balancer's, not Baton's: the connection is dropped (typically 1006) with no close reason. Open a new session before the hour is up.
- **Ending a session.** `session.end` sends `session.summary` and closes at once. A `turn.hint` or `turn.answer` still pending is not sent, so wait for them before you send `session.end`.

## HTTP limits

Keep HTTP scoring requests under 600 per minute per key. Above that, requests may be refused with 429 and `Retry-After: 60`. A request can also get 429 with `Retry-After: 1` when the service is momentarily at capacity; retry it. While the service is starting up: 503 with `Retry-After: 30`.
