RPC error HTTP 410 / -32602: beyond_retention
Last updated:
At a glance
| Property | Value |
|---|---|
| Applies to | Stellar (Soroban RPC and Horizon) |
| Horizon REST | HTTP 410 Gone, error=beyond_retention, oldest=N |
| Soroban JSON-RPC | -32602, beyond_retention, oldest N |
| Soroban window | about 120,960 ledgers |
| Horizon retention | 6,307,191 ledgers (measured) |
| Retryable | No — the boundary does not move on retry |
Cause
Stellar history on Triport lives in a measured window, and the two surfaces report its edge differently. Horizon REST answers HTTP 410 Gone with error=beyond_retention and oldest=N; Soroban JSON-RPC answers -32602 with beyond_retention and the oldest available ledger in the message. Both mean the same thing: the ledger you asked for is below the boundary of the node that served you. It is the measured retention of that node, not an internal failure, and repeating the same historical request will not move the boundary.
Solution
- Read the oldest value from the response and clamp your query to it instead of retrying the same range.
- Page forward from that oldest ledger rather than backwards from an arbitrary start — Soroban keeps about 120,960 ledgers, Horizon far more.
- For anything older than the window, serve from your own index; a provider window is an operational buffer, not an archive.
- Do not treat the error as an empty result: an empty list would let your code conclude that nothing happened, which is the one wrong conclusion here.
Example
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32602,
"message": "beyond_retention: oldest 57926881"
}
}FAQ
- Does beyond_retention mean the data never existed?
- No. It means the node that served you no longer keeps that ledger. The records existed on the network; they are simply outside the retention window of this endpoint.
- Should I retry the request?
- No. The boundary is the measured retention of the node, so the same historical request will keep failing. Clamp to the oldest ledger in the response, or read from your own store.
- Why do Horizon and Soroban report it differently?
- They are different transports: Horizon is REST and answers HTTP 410 Gone, while Soroban is JSON-RPC and answers -32602. The boundary class is the same; only the envelope differs.
- Is this the same as limit must not exceed 200?
- No. That is a page-size error (HTTP 400) telling you to ask for fewer records per page, and it is unrelated to how far back the node keeps history.