Overview
ACP uses JSON-RPC 2.0 error codes to communicate errors between clients and agents. This page lists all standard and ACP-specific error codes used in the protocol.Standard JSON-RPC Error Codes
These error codes are defined by the JSON-RPC 2.0 specification.| Code | Name | Description | When Used |
|---|---|---|---|
-32700 | Parse error | Invalid JSON was received | When the server receives malformed JSON that cannot be parsed |
-32600 | Invalid request | The JSON sent is not a valid Request object | When the request is missing required fields or has invalid structure |
-32601 | Method not found | The method does not exist or is not available | When a requested method is not implemented or not supported by the current connection |
-32602 | Invalid params | Invalid method parameter(s) | When method parameters fail validation or don’t match the expected schema |
-32603 | Internal error | Internal JSON-RPC error | When an unexpected error occurs during request processing |
ACP-Specific Error Codes
These error codes are specific to the Agent Client Protocol.| Code | Name | Description | When Used |
|---|---|---|---|
-32000 | Authentication required | Authentication is required before proceeding | When an agent requires authentication before creating sessions |
-32002 | Resource not found | A resource (such as a file) was not found | When a requested file, session, or other resource cannot be located |
Error Code Ranges
JSON-RPC 2.0 reserves specific ranges for different types of errors:-32768to-32000: Reserved for JSON-RPC specification errors-32099to-32000: Server error range (implementation-defined)- Custom application errors: Should use codes outside the reserved range
Usage Examples
Parse Error (-32700)
Invalid Request (-32600)
Method Not Found (-32601)
Invalid Params (-32602)
Internal Error (-32603)
Authentication Required (-32000)
Resource Not Found (-32002)
Error Handling Best Practices
1. Use Specific Error Codes
Choose the most specific error code for the situation:2. Include Helpful Error Data
Provide additional context in thedata field:
3. Handle Errors Gracefully
Catch and convert errors appropriately:4. Document Custom Error Codes
If you define custom error codes (outside the reserved range), document them clearly:See Also
- RequestError Class - Error class API reference
- JSON-RPC Types - JSON-RPC type definitions
- JSON-RPC 2.0 Specification - Official error object specification