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

# Error envelope

> The API error envelope.

## Shape

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "error": {
    "message": "human-readable description",
    "code": "invalid_request",
    "param": "model"
  }
}
```

| Field | Type | Notes |
| - | - | - |
| `message` | string | Human-readable description of the failure. |
| `code` | string | The error family. The category lives here. See [Error codes](/api/api-reference/errors-and-rate-limits/error-codes). |
| `param` | string | Optional. The request field the error refers to, when applicable (for example `model`). |

Errors carry a `code`, not a `type`; branch on `code`.

## Mid-Stream

An error after a stream has opened arrives as a chunk with a top-level `error` object and a terminal choice with `finish_reason: "error"`. See [Error events](/api/api-reference/streaming-format/error-events).

## Related

* [Error codes](/api/api-reference/errors-and-rate-limits/error-codes)
* [Status mapping](/api/api-reference/errors-and-rate-limits/status-mapping)
* [Debugging requests](/api/api-reference/errors-and-rate-limits/debugging-requests)


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