Module 11: Error Handling
Handle protocol errors from agents on the client side.What Youâll Learn
- Catching
AcpError(com.agentclientprotocol.sdk.spec.AcpError) - Standard error codes in
AcpErrorCodes - Throwing
AcpProtocolExceptionfrom agent handlers - Error recovery â continuing after errors
The Code
ACP uses structured errors based on JSON-RPC error codes. On the client side, protocol errors arrive asAcpError exceptions. AcpError is one type on both sides (com.agentclientprotocol.sdk.spec.AcpError), replacing the older AcpClientSession.AcpError and AcpAgentSession.AcpError. You can inspect the error code to determine what went wrong:
AcpProtocolException with a standard error code. The SDK converts it to a JSON-RPC error response:
Error Codes
AcpErrorCodes keeps only the codes the ACP v1 schema defines:
See the 0.80.0 migration guide if youâre carrying forward code that used
SESSION_NOT_FOUND, PERMISSION_DENIED, CAPABILITY_NOT_SUPPORTED, NOT_INITIALIZED, or CONCURRENT_PROMPT: those names and codes changed or were removed.
Agents throw AcpProtocolException with one of these codes. The SDK converts it to a JSON-RPC error response. Clients catch it as AcpError.