Error Codes
The RPC Gateway returns JSON-RPC 2.0 errors with custom -16xxx codes for validation, rate-limit and upstream node failures, usually with HTTP status 200 OK.
The Tatum RPC Gateway follows the JSON-RPC 2.0 specification
When a request fails, the Gateway returns structured error codes that help determine whether the issue originates from:
- the client request,
- the Gateway middleware, or
- the upstream blockchain node.
Tatum Gateway Error Codes
Tatum extends the JSON-RPC standard with custom error codes to clearly distinguish between validation issues, rate limits, middleware failures, and upstream node problems.
| Code | Message | Description |
|---|---|---|
| -16401 | Invalid Request | The request format or structure was invalid. Verify JSON syntax and required fields. |
| -16402 | Invalid JSON-RPC requestItem | One or more items in a batch request failed validation. |
| -16405 | Method not found: # | The requested RPC method is not supported or not enabled for the selected blockchain. |
| -16412 | Number of transactions exceeds limit of #Requested range is over limit of # | The request payload failed validation due to exceeding permitted limits. |
| -16429 | Too many requests to upstream | You have exceeded your rate limit. Reduce the request frequency or upgrade your plan. |
| -16500 | Invalid response from upstream | The upstream node returned a malformed or unexpected response. |
| -16502 | Invalid upstream response body | The upstream node’s response body was incomplete, missing fields, or not parsable. |
| -16503 | No healthy upstream available | No healthy node was available to serve the request. The Gateway could not route the call. |
| -16504 | Internal error | Internal middleware or infrastructure failure. Retry or check Tatum Status. |
Standard JSON-RPC Error Codes
| Code | Message | Description |
|---|---|---|
| -32700 | Parse error | Invalid JSON was received by the server. |
| -32600 | Invalid Request | The JSON sent is not a valid Request object. |
| -32601 | Method not found | The method does not exist or is not available. |
| -32602 | Invalid params | Invalid method parameters. |
| -32603 | Internal error | Internal JSON-RPC error. |
| -32000 to -32099 | Server error | Reserved for implementation-defined server errors. |
Why errors return HTTP 200 (JSON-RPC 2.0)
Even when a request fails, for example because of an upstream node timeout, the Gateway returns the HTTP status 200 OK. This behavior is intentional and follows the JSON-RPC 2.0 specification, which defines application-level errors in the JSON payload, not in the HTTP transport layer:
200 OK: the transport worked and a valid JSON-RPC response was delivered.errorobject in the payload: the request itself failed, often because of upstream node issues or Gateway-level exceptions.
Example:
{
"id": 1,
"jsonrpc": "2.0",
"error": {
"code": -16500,
"message": "Invalid response from upstream"
}
}The error code -16500 means that the request reached the Gateway, but the upstream node failed to respond as expected.
Streamed responses keep the HTTP status
For large requests, such as Solana getBlocks or getTokenAccountsByOwner with many accounts, the Gateway uses HTTP chunked transfer encoding. This lets it stream partial responses as soon as they are ready, avoid buffering large responses in memory, and retry failed items while it keeps sending successful ones.
Because the response body is streamed incrementally:
- Headers, including the HTTP status, are locked once streaming begins.
- Partial successes and failures are reported inside the JSON payload.
- The response cannot switch to a
4xxor5xxstatus later in the response lifecycle.
Best practices for handling JSON-RPC errors
If your monitoring relies only on HTTP status codes, it can miss application-level failures. Check your client against this list:
- Treat
200 OKas "transport successful," not "application successful." - Always parse the JSON-RPC response and check for an
errorobject. - Use the
-16xxxcodes from Tatum Gateway Error Codes to detect Gateway and upstream errors, and base your fallback logic on them. - Treat any response with an
errorobject as a failure for retries or provider rotation. - In streamed responses, check the payload for failed items: partial failures do not change the HTTP status.
Updated 3 days ago