Class A2AError

All Implemented Interfaces:
Serializable, Event
Direct Known Subclasses:
A2AProtocolError, InternalError, InvalidParamsError, InvalidRequestError, JSONParseError, MethodNotFoundError

public class A2AError extends RuntimeException implements Event
Marker interface for A2A Protocol error events.

This interface extends Event to allow errors to be transmitted as events in the A2A Protocol's event stream. All protocol-level errors implement this interface, enabling uniform error handling across both streaming and non-streaming communication.

A2A errors typically extend A2AError to provide JSON-RPC 2.0 compliant error responses with standard error codes, messages, and optional additional data.

Common implementations include:

See Also:
  • Constructor Details

    • A2AError

      public A2AError(Integer code, String message, @Nullable Map<String,Object> details)
      Constructs a JSON-RPC error with the specified code, message, and optional details.

      This constructor is used by Jackson for JSON deserialization.

      Parameters:
      code - the numeric error code (required, see JSON-RPC 2.0 spec for standard codes)
      message - the human-readable error message (required)
      details - additional error details as key-value pairs (defaults to empty map if null)
      Throws:
      IllegalArgumentException - if code or message is null
  • Method Details

    • getCode

      public Integer getCode()
      Gets the numeric error code indicating the error type.

      Standard JSON-RPC 2.0 error codes:

      • -32700: Parse error
      • -32600: Invalid Request
      • -32601: Method not found
      • -32602: Invalid params
      • -32603: Internal error
      • -32000 to -32099: Server error (implementation-defined)
      Returns:
      the error code
    • getDetails

      public Map<String,Object> getDetails()
      Gets additional details about the error as key-value pairs.
      Returns:
      the error details, never null (empty map if no details provided)