The Nolimitnodes API returns standard JSON-RPC 2.0 error responses. This page documents common error codes and recommended handling strategies.
A human-readable description of the error.
Optional additional error details.
The request ID that caused the error.
Example Error Response
{
"jsonrpc": "2.0",
"error": {
"code": -32600,
"message": "Invalid request"
},
"id": 1
}
JSON-RPC Error Codes
| Code | Message | Description |
|---|
-32700 | Parse error | Invalid JSON in the request body. |
-32600 | Invalid request | The request object is not a valid JSON-RPC 2.0 request. |
-32601 | Method not found | The requested RPC method does not exist. |
-32602 | Invalid params | Invalid method parameters. |
-32603 | Internal error | An internal server error occurred. |
HTTP Status Codes
| Code | Meaning | Action |
|---|
200 | Success | Request processed successfully. |
400 | Bad Request | Check your request format and parameters. |
401 | Unauthorized | Invalid or missing API key. |
429 | Too Many Requests | Rate limit exceeded. Implement exponential backoff. |
500 | Internal Server Error | Retry after a brief delay. |
503 | Service Unavailable | The node is temporarily unavailable. Retry later. |
Handling Errors
async function safeRpcCall(endpoint, method, params = []) {
const response = await fetch(endpoint, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
});
if (response.status === 429) {
throw new Error("Rate limited — retry with backoff");
}
if (response.status === 401) {
throw new Error("Invalid API key");
}
const data = await response.json();
if (data.error) {
throw new Error(`RPC Error ${data.error.code}: ${data.error.message}`);
}
return data.result;
}
WebSocket Error Handling
For WebSocket connections, handle disconnections gracefully with automatic reconnection:
function connectWithReconnect(url, maxRetries = 5) {
let retries = 0;
function connect() {
const ws = new WebSocket(url);
ws.on("open", () => {
retries = 0; // Reset on successful connection
});
ws.on("close", () => {
if (retries < maxRetries) {
const delay = Math.pow(2, retries) * 1000;
retries++;
setTimeout(connect, delay);
}
});
ws.on("error", (err) => {
console.error("WebSocket error:", err.message);
ws.close();
});
return ws;
}
return connect();
}