# Errors and retries

The one error shape every route uses, and what to do with each status code.

## Error shape

Every error answer is JSON with three fields:

```json
{"error": "blockchain: unknown chain: \"ethereum\"", "message": "blockchain: unknown chain: \"ethereum\"", "statusCode": 400}
```

`error` and `message` carry the same text.
For a `4xx` status the text says what was wrong with the request.
For a `5xx` status the text is usually only the status name, for example `Service Unavailable`.

## What to do

| Status | Meaning | Action |
|---|---|---|
| `400` | The request is malformed: a bad address, an unknown chain, or a bad parameter value. | Fix the request. Do not retry unchanged. |
| `401` | The key is missing, unknown or revoked. | Send `Authorization: <key>`. |
| `403` | Refused at the edge, for example `Bearer <key>`. | Send the bare key. |
| `404` | The chain is not served, or the token or resource is not known. | Check the chain id and address. |
| `410` | A stream's `from_seq` is no longer held. | Resume with `from_block`. |
| `429` | The key's rate limit is reached. | Back off exponentially, then retry. |
| `500` | A read failed. | Retry with exponential backoff, a few times at most. |
| `501` | The requested option is not served yet, for example a holder sort other than `balance`. | Use a served option. |
| `502` | The logo store failed. | Retry later. |
| `503` | Busy, catching up, or starting. | Wait the `Retry-After` header's seconds when sent (5 or 10), then retry. |
| `504` | A read ran past its time limit. | Retry later, or narrow the request with `pool` or a smaller `limit`. |

## Empty is not an error

A known token with no activity answers `200` with zeros, `null` values or empty lists.
A `pool` that does not belong to the token answers `200` with an empty list.
A value that cannot be computed exactly is `null`, never `0`.

## Solana

On 2026-11-30, trades and liquidity answered `500` on Solana, and holders answered `503`.
Those routes serve EVM chains; Solana support for them is in progress.
Stats, candles and launches answered `200` on Solana.
