> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meetjamie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> HTTP errors, stream errors, close codes and end reasons.

## HTTP errors when connecting

Errors before the WebSocket opens are JSON: `{"error":"<code>"}`, sometimes with extra fields. Allow up to 30 s for the opening handshake before treating a connect as failed.

| Status | Code | Meaning |
| - | - | - |
| 400 | `invalid_audio_format` | Unsupported `encoding`, `sample_rate` or `channels`; `message` says which. |
| 400 | `invalid_request` | A malformed query parameter; `message` has details. |
| 401 | `unauthorized` | Missing, malformed, unknown or revoked token. |
| 402 | `insufficient_credit` | Your account has no credit left, or you have not claimed your free credit yet, so a new session cannot start. Check your balance under [Credits](https://platform.meetjamie.ai/credits). Reconnects to an existing session are not affected. |
| 404 | `session_not_found` | The session id is malformed, unknown, expired or belongs to another account. |
| 404 | `not_found` | Unknown path or method. |
| 410 | `session_ended` | The session has ended and its result is no longer available. Includes `phase` and `completion`. |
| 426 | `websocket_required` | `/v1/platform/diarize` was requested without a WebSocket upgrade. |
| 429 | `rate_limited` | Too many requests; retry after `retry-after` seconds. |
| 429 | `concurrency_limit` | Your account already has 10 sessions that have not ended. No `retry-after` is sent: retry once one of them ends, and end sessions with `finalize` rather than just closing them. |
| 502 | `gateway_unavailable`, `adapter_unavailable` | Temporary server problem; retry with backoff. For a reconnect, the session is still there. |
| 503 | `capacity_full`, `store_unavailable` | Temporarily out of capacity or unavailable; retry with backoff. |
| 500 | `internal_error` | Unexpected server error; retry with backoff. |

## Stream errors

| Code | Meaning | What happens next |
| - | - | - |
| `invalid_message` | A text message that is not `finalize` or `keepalive`. | Nothing; the stream continues. |
| `frame_too_large` | An audio frame over 16,000 bytes. | Close `1009`. The session stays open; reconnect and send smaller frames. |
| `client_inactive` | Nothing arrived from you for 60 s. | Close `4004`. The session stays open; reconnect to continue. |
| `ahead_of_realtime` | Audio arrived faster than real time. | The session ends: `final`, `finished`, close `4003`. |
| `credit_exhausted` | Your account ran out of credit during the session. | Followed by `final` with reason `credit_exhausted`, `finished` and close `4005`. |
| `result_incomplete` | The session ended because of a server error. | Followed by `final` with everything decided so far; the last \~10 s may be missing. |

## Close codes

| Code | Meaning |
| - | - |
| `1000` | Session ended normally after `final` and `finished`. |
| `1009` | Audio frame too large. The session is still open. |
| `4001` | Superseded: a newer connection attached to this session and now receives its updates. Do not reconnect from this connection. |
| `4002` | The session has ended without a result to deliver. |
| `4003` | Session ended because audio arrived ahead of real time. |
| `4004` | Closed after 60 s without client activity. The session is still open. |
| `4005` | Session ended because your account ran out of credit. |
| `1005`, `1006` | The connection dropped without a regular close. [Reconnect](https://docs.meetjamie.ai/platform/reconnecting.md) with the session id. |

## End reasons

The `reason` in `final`:

| Reason | Meaning |
| - | - |
| `finalized` | You sent `finalize`. |
| `idle_timeout` | No connection for 300 s. |
| `max_duration` | 5 hours of wall-clock time passed since the session started. To keep going, open a new session. |
| `ahead_of_realtime` | Audio arrived faster than real time. |
| `credit_exhausted` | Your account ran out of credit. Add credit under [Credits](https://platform.meetjamie.ai/credits) before you open a new session. |
| `drain` | The session was ended for server maintenance; `final` holds the result so far. To keep going, open a new session. |
| `engine_failed` | A server error ended the session; preceded by `result_incomplete`. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.