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.

CodeMessageDescription
-16401Invalid RequestThe request format or structure was invalid. Verify JSON syntax and required fields.
-16402Invalid JSON-RPC requestItemOne or more items in a batch request failed validation.
-16405Method not found: #The requested RPC method is not supported or not enabled for the selected blockchain.
-16412Number of transactions exceeds limit of #
Requested range is over limit of #
The request payload failed validation due to exceeding permitted limits.
-16429Too many requests to upstreamYou have exceeded your rate limit. Reduce the request frequency or upgrade your plan.
-16500Invalid response from upstreamThe upstream node returned a malformed or unexpected response.
-16502Invalid upstream response bodyThe upstream node’s response body was incomplete, missing fields, or not parsable.
-16503No healthy upstream availableNo healthy node was available to serve the request. The Gateway could not route the call.
-16504Internal errorInternal middleware or infrastructure failure. Retry or check Tatum Status.

Standard JSON-RPC Error Codes

CodeMessageDescription
-32700Parse errorInvalid JSON was received by the server.
-32600Invalid RequestThe JSON sent is not a valid Request object.
-32601Method not foundThe method does not exist or is not available.
-32602Invalid paramsInvalid method parameters.
-32603Internal errorInternal JSON-RPC error.
-32000 to -32099Server errorReserved 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.
  • error object 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 4xx or 5xx status 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 OK as "transport successful," not "application successful."
  • Always parse the JSON-RPC response and check for an error object.
  • Use the -16xxx codes from Tatum Gateway Error Codes to detect Gateway and upstream errors, and base your fallback logic on them.
  • Treat any response with an error object 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.

What’s Next

Did this page help you?