# Error codes (/docs/proxy/reference/error-codes)



## Response format [#response-format]

Errors use the provider's own error format, so the official SDKs raise their
usual exceptions.

OpenAI shape:

```json
{
  "error": {
    "message": "Invalid or expired TawaGuard proxy token",
    "type": "invalid_request_error",
    "param": null,
    "code": "tawa_invalid_token"
  }
}
```

Anthropic shape (no `code` field; the message names the code):

```json
{
  "type": "error",
  "error": {
    "type": "authentication_error",
    "message": "Invalid or expired TawaGuard proxy token"
  }
}
```

| Status | `code` (OpenAI shape)                | Anthropic `error.type`  | Meaning                                                                                                          |
| ------ | ------------------------------------ | ----------------------- | ---------------------------------------------------------------------------------------------------------------- |
| 400    | `tawa_blocked`                       | `invalid_request_error` | Blocked by a scan. The message starts with `Blocked by TawaGuard`.                                               |
| 400    | `tawa_upstream_unresolved`           | `invalid_request_error` | The provider is not named or is not on the app's list. See [Routing rules](/docs/proxy/reference/routing-rules). |
| 400    | `tawa_provider_not_allowed`          | `invalid_request_error` | None of the requested OpenRouter providers is allowed.                                                           |
| 400    | `tawa_provider_policy_invalid`       | `invalid_request_error` | The `provider` field of the request is not an object.                                                            |
| 400    | `tawa_provider_policy_unenforceable` | `invalid_request_error` | The entry has provider limits and the body is compressed, not JSON or too large.                                 |
| 401    | `tawa_invalid_token`                 | `authentication_error`  | Token unknown, revoked, expired or malformed. One response for all four.                                         |
| 404    | `tawa_path_not_proxied`              | `not_found_error`       | Path is not served.                                                                                              |
| 413    | `tawa_request_too_large`             | `invalid_request_error` | Request body over the limit.                                                                                     |
| 429    | `tawa_rate_limited`                  | `rate_limit_error`      | A limit above was reached.                                                                                       |
| 502    | `tawa_scan_unavailable`              | `api_error`             | Scan failed and Fallback is `closed`.                                                                            |
| 502    | `tawa_upstream_blocked`              | `api_error`             | The provider's address is not reachable from the proxy (private or non-HTTPS).                                   |
| 502    | `tawa_upstream_unreachable`          | `api_error`             | The proxy could not reach the provider.                                                                          |
| 503    | `tawa_auth_unavailable`              | `api_error`             | Token could not be verified. `Retry-After: 5`.                                                                   |
| 503    | `tawa_proxy_overloaded`              | `api_error`             | Process-wide limit reached. `Retry-After: 1`.                                                                    |

A blocked response carries the header `x-tawa-blocked-stage` with the stage
that blocked it: `prompt`, `tool-output`, `tool-call` or `response`.

When a streamed response is blocked after it has started, the status is
already `200`. The proxy ends the stream with an error event in the same
provider format.

## Common fixes [#common-fixes]

| Code                                 | What to do                                                                                                                                                                                    |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tawa_upstream_unresolved`           | Name a provider in the URL or in `x-tawa-upstream`, or set a **Default provider** and use `/auto`. Check the name is on the app's [allowed providers](/docs/proxy/routing/allowed-providers). |
| `tawa_provider_not_allowed`          | The request asked for OpenRouter providers that your [provider limits](/docs/proxy/routing/openrouter-provider-limits) exclude. Ask for a provider the limits allow.                          |
| `tawa_provider_policy_unenforceable` | Send the request as uncompressed JSON within the body limit. Remove any `Content-Encoding` header.                                                                                            |
| `tawa_upstream_blocked`              | Use a public HTTPS address for the custom endpoint. See [Custom endpoints](/docs/proxy/routing/custom-endpoints).                                                                             |
| `tawa_path_not_proxied`              | Call a path that matches the entry's format. See [Paths and limits](/docs/proxy/reference/paths-and-limits).                                                                                  |
| `tawa_invalid_token`                 | Check the token is complete, active and from the right app. See [Proxy tokens](/docs/proxy/configure/tokens).                                                                                 |
