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

# Error handling

> Sync STT error responses, status codes, and retry guidance.

Errors return a JSON body with either an `error_code` field (audio, capacity, and inference errors) or a `detail` field (auth and rate-limit errors).

```json theme={null}
{ "error_code": "audio_too_large", "message": "audio duration 130000 ms exceeds limit 120000 ms" }
```

| HTTP | `error_code`             | Cause                                                                      |
| ---- | ------------------------ | -------------------------------------------------------------------------- |
| 400  | `bad_audio`              | Malformed WAV, misaligned PCM, or missing `sample_rate`/`channels` for PCM |
| 400  | `audio_too_short`        | Audio below 80 ms                                                          |
| 400  | `bad_request`            | Missing `audio` part, invalid config JSON, or field limits exceeded        |
| 401  | —                        | Missing or invalid API key                                                 |
| 413  | `audio_too_large`        | Duration > 120 s or file > 40 MB                                           |
| 415  | `unsupported_media_type` | Unsupported format, non-16-bit audio, or unsupported sample rate           |
| 429  | —                        | Rate limit exceeded — retry after `Retry-After` header                     |
| 503  | `capacity_exceeded`      | Server at rate limit cap — retry after `Retry-After: 1`                    |
| 503  | `service_unavailable`    | Model still loading (cold start)                                           |
| 504  | `inference_timeout`      | Request exceeded the 30 s deadline                                         |
| 500  | `inference_error`        | Internal model error                                                       |

## Retry guidance

* **429 and 503** are transient — retry after the `Retry-After` header (or a short backoff when absent).
* **400, 413, and 415** indicate a problem with the request itself — fix the audio or config before retrying. See [Audio requirements](/sync-stt/audio-requirements) for the constraints.
* **500 and 504** are safe to retry once; persistent failures warrant a support ticket.

## Need help?

If you get stuck, contact our support team at [support@assemblyai.com](mailto:support@assemblyai.com) or create a [support ticket](https://www.assemblyai.com/contact/support). Include the `session_id` from the response (or the failing request's timestamp and endpoint if no response was returned) to help us look up your request.
