JSON-RPC 2.0 error code reference
JSON-RPC 2.0 is a lightweight remote-procedure-call protocol that encodes calls and responses as JSON. When a call fails, the response carries an error object with an integer code, a human message, and optional data. The spec predefines a small set of codes and reserves a range for transport-level failures, leaving everything else to your application. This reference lists each predefined code and exactly when it applies.
How it works
A response is either a success or an error, never both:
{ "jsonrpc": "2.0", "id": 1, "result": 42 }
{ "jsonrpc": "2.0", "id": 1, "error": { "code": -32601, "message": "Method not found" } }
The predefined codes form a pipeline that mirrors how a server processes a request:
-32700Parse error — the bytes are not valid JSON, so nothing else can happen.-32600Invalid Request — the JSON parsed but is not a conforming Request object.-32601Method not found — the named method does not exist.-32602Invalid params — the method exists but its arguments are wrong.-32603Internal error — a generic server-side failure during handling.
The range -32000 to -32099 is reserved for implementation-defined server errors (transport, auth, rate limiting). The whole band -32768 to -32000 is off-limits to applications; any code outside that band is yours to use freely.
Tips and notes
- Match the code to the failure stage: bad JSON is
-32700, a missingmethodmember is-32600, an unknown method is-32601— they are not interchangeable. - Put machine-readable detail in
data(for example validation paths), and keepmessageshort and stable. - For your own domain errors, pick codes well outside
-32768..-32000so they can never collide with protocol codes. - Notifications (requests without an
id) must not receive a response, including error responses — drop them silently per the spec.