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

# Errors

> The error shape, every error code, and what to do about each.

Errors are a JSON object with an `error` field:

```json theme={null}
{"error": {"message": "no ready miner serves this model", "type": "invalid_request_error", "code": "no_miner_available"}}
```

### Numeric codes and reasons Not live yet

```json theme={null}
{"error": {"code": 402, "message": "prepaid balance ...", "metadata": {"reason": "insufficient_balance", "available": "0", "required": "<amount>"}}}
```

`code` becomes the HTTP status as a number, and the reason string below moves to `error.metadata.reason`. Read the reason as `error.metadata.reason`, falling back to `error.code` when it is a string, and the code works with both shapes.

When a session was started before the error, `error.session_id` (or `error.metadata.session_id`) is set. Look it up with `GET /v1/sessions/{id}` to see every attempt and any channel that was opened.

| HTTP | `code` | Meaning | What to do |
| - | - | - | - |
| 202 | (not an error) | `object: "chat.completion.pending"`: no verified reply within the response deadline. The session continues. | Poll `GET /v1/sessions/{id}` until `reply` is set, or use `stream: true`. |
| 400 | `invalid_json`, `model_required`, `messages_required`, `invalid_message`, `invalid_max_tokens` | The body is not valid. | Fix the request. The message says which field. |
| 400 | `unsupported` | The request asks for something not supported: `tools`, or `n` above 1. | Remove the field. |
| 400 | `invalid_provider`, `invalid_sort`, `invalid_payer`, `invalid_address` | A `provider`, `flop.payer` or address value is wrong. | See [routing](https://docs.floprouter.com/routing.md) and [payer modes](https://docs.floprouter.com/payer-modes.md). |
| 400 | `escrow_limit` | The escrow for this request would pass the maximum per request. | Lower `max_tokens` or shorten the prompt. |
| 401 | `unauthorized` | Missing, unknown or revoked key, or the payer mode needs a wallet key. | Check the `Authorization` header. Create a key on the [account page](https://floprouter.com/account/). |
| 401 | `invalid_challenge`, `challenge_expired`, `challenge_used`, `invalid_signature` | Sign-in failed. | Ask for a new challenge and sign it with the same address. |
| 402 | `insufficient_balance` | Your prepaid balance cannot cover the request. The error carries `available` and `required`. | [Top up](https://docs.floprouter.com/fees.md) or lower `max_tokens`. |
| 402 | `insufficient_funds` | In grant mode, your wallet cannot cover the escrow. | Fund your wallet. |
| 402 | `grant_required`, `grant_expired`, `grant_expiring`, `grant_revoked`, `grant_exhausted`, `grant_not_usable`, `grant_per_tx_limit` | Grant mode, and the grant cannot pay for this request. | Sign a new grant on the [account page](https://floprouter.com/account/), or raise its caps. |
| 404 | `model_not_found` | Unknown model id. | Use an id from `GET /v1/models`. |
| 404 | `miner_not_found`, `session_not_found`, `key_not_found`, `not_found` | Unknown miner, session, key or path. | |
| 403 | `forbidden` | The request did not come through the public endpoint. | Use the documented base URL. |
| 409 | `too_many_keys` | This wallet has the most active keys allowed. | Revoke one first. |
| 200, in a stream | `stream_mismatch` | The streamed text differs from the verified reply. | Use `verified_content` from the error chunk. |
| 413 | `body_too_large` | The request body is too large. | Shorten the prompt. |
| 429 | `rate_limited`, `too_many_concurrent`, `grant_daily_cap`, `demo_budget_exhausted` | A rate, concurrency, grant daily or demo limit was reached. | Wait for the `Retry-After` header, or use a wallet key. |
| 503 | `all_attempts_failed` | Every miner tried failed before producing output. It is 503, not 502, because common SDKs retry a 502 at once, and each retry can cost an on-chain fee. | Wait for `Retry-After`, or choose other miners. |
| 503 | `no_miner_available` | No ready miner matches the model and your `provider` rules. | Check the [ready miners](https://floprouter.com/miners/?reach=ready) or relax `provider`. |
| 503 | `payer_underfunded`, `daily_cap_reached`, `delegate_unfunded`, `payer_unavailable` | The router's wallet cannot pay right now, or hit its daily cap. | Retry later. |
| 503 | `shutting_down` | The service is restarting. | Retry in a few seconds. |

This list follows the server at the time of writing; [`/openapi.json`](https://floprouter.com/openapi.json) is the reference. Treat an unknown 5xx as retryable after a pause, and any 4xx as a problem with the request.

429 and 503 responses carry a `Retry-After` header.

## Retries

The router already retries on another miner when an attempt fails before any output. A reply that started is never retried, so a client-side retry can open a second channel. Retry after an error, never after a slow reply: a normal reply takes 15 to 50 s on devnet. Set your client timeout to at least 120 s.

```python theme={null}
requests.post(url, json=body, headers=headers, timeout=120)  # one request, no automatic retries
```


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