# Errors and retries

Resolve request, authentication, balance, and service errors. Retry only when appropriate, with explicit limits.

## Read status and type.

Read the HTTP status and error type. Generated errors currently use `param: null` and `code: null`; upstream responses may provide different details.

### Gateway error

```json
{"error":{"message":"...","type":"invalid_request_error","param":null,"code":null}}
```

**HTTP outcomes**

| Status | Meaning |
| --- | --- |
| 400 | Invalid JSON, content type, request field, role, or output budget. |
| 401 | Missing, invalid, or inactive API key. |
| 402 | The available balance cannot cover the requested maximum. |
| 404 | Unknown model ID or endpoint. |
| 409 | An accounting update conflicted with another request. |
| 429 | A budget or concurrency limit rejected the request. |
| 502/503 | The inference worker failed or is unavailable. |
| 504 | The inference request timed out. |

## Fix deterministic failures.

Do not retry errors caused by invalid JSON, unsupported fields, an unknown model, or invalid credentials.

- 400: correct the request schema or output budget.
- 401: check the API key and its deployment.
- 402/409/429: check the error message for balance, accounting, or concurrency failures.
- 503: check model availability before retrying.

## Bounded retries only.

Blaschke retries specific model-loading 503 responses a limited number of times. It does not generally retry POST requests or resume interrupted streams.

- Use bounded exponential backoff with jitter for retryable transport or server failures.
- `Retry-After` may be absent; use your own bounded delay.
- A timeout does not establish whether a request was processed.
- Keep a request journal to reconcile interrupted or expensive requests.

## Related guides

- [Limits and compatibility](https://beta.blaschkelabs.com/docs/limits): Bound a request before sending it.

Source: https://beta.blaschkelabs.com/docs/errors

Markdown: https://beta.blaschkelabs.com/docs/md/errors.md
