Skip to main content
Failed requests return a JSON-RPC 2.0 error object:
  • code: an integer identifying the kind of error
  • message: a short, human-readable description of the error, in plain text
  • data (optional): additional information whose shape depends on the code

Error codes

Receivers MUST treat an unrecognized code as a generic failure. Implementation-specific errors SHOULD use codes outside -32768 to -32000 and -32899 to -32800, which are reserved for JSON-RPC and ACP. ACP takes -32800 (Request cancelled) from the second range, which LSP also reserves.

Common cases

Unknown methods

A receiver that does not implement a method, or receives a capability-gated method it did not advertise, MUST respond with -32601. This applies to custom and standard methods alike. Notifications can’t be answered, so receivers SHOULD ignore unknown ones. tool_call/cancel and terminal/cancel are not gated by a capability in initialize. A tool call or terminal advertises capabilities.cancel itself. An Agent that implements the method answers -32602, not -32601, for an item that does not advertise it. See Cancelling tool calls and Cancelling terminals.

Invalid parameters

Malformed parameters and unsupported values get -32602. For example, an invalid session/list cursor, or in session/set_config_option an unknown configId, an invalid value, or a value type that is unsupported or doesn’t match the option. A systemPrompt with an unadvertised mode, an unsupported content block type, or content that exceeds the Agent’s limits gets -32602. See System prompt.

Unknown sessions

If a session-scoped request names a session that does not exist or is not active on the connection, the Agent MUST respond with -32002 and set data.sessionId to the requested ID. A session is active once it is created, resumed, or forked on the connection, until it is closed or the connection ends. See Session Lifecycle. This applies to session/prompt, session/set_config_option, tool_call/cancel, and terminal/cancel, and to session/resume of a session that does not exist or was deleted. session/close and session/delete are exceptions: Agents SHOULD still return success when closing a session that does not exist or is not active, or deleting one that does not exist. Clients SHOULD treat a -32002 response to either as success. See Closing Active Sessions and Deleting Sessions. A child session that the Agent announced with subagent_update is not an unknown session, although the Client did not create or resume it. session/cancel, tool_call/cancel, and terminal/cancel can name a child as Restricted methods describes. Agents SHOULD reject any other request that names a child with -32602.

Requests before initialization

Agents MUST reject any request other than initialize that arrives before initialization completes with -32600, and ignore notifications. They MUST also reject an initialize repeated after another request with -32600. See Before Initialization Completes.

Unstable features

  • session/fork of a session that does not exist gets -32002, as for unknown sessions. The source session only has to exist. It doesn’t have to be active on the connection.
  • session/status of a session the Agent does not know gets -32002, with data.sessionId set to the requested ID. A session that exists but isn’t active on the connection is not an error. The Agent reports its status.
  • session/archive and session/unarchive of a session that does not exist get -32002. Unlike session/delete, they don’t succeed silently. An archived filter value the Agent does not support gets -32602. See Archived Sessions.
  • session/set_title of a session that does not exist gets -32002. The session only has to exist. It doesn’t have to be active on the connection. A title the Agent rejects gets -32602.
  • providers/* methods called without the providers capability get -32601.