pub enum A2aError {
Show 14 variants
TaskNotFound {
task_id: String,
},
TaskNotCancelable {
task_id: String,
current_state: String,
},
PushNotificationNotSupported,
UnsupportedOperation {
method: String,
},
ContentTypeNotSupported {
media_type: String,
},
InvalidAgentResponse {
message: String,
},
ExtendedAgentCardNotConfigured,
ExtensionSupportRequired {
uri: String,
},
VersionNotSupported {
requested: String,
supported: Vec<String>,
},
InvalidParams {
message: String,
},
Internal {
message: String,
},
MethodNotFound {
method: String,
},
InvalidStateTransition {
from: String,
to: String,
},
PushDeliveryFailed {
message: String,
},
}server and a2a-v1 only.Expand description
A2A v1.0.0 protocol errors.
Each variant maps to a specific JSON-RPC error code and HTTP status code as defined in the A2A Protocol v1.0.0 specification §5.4.
Variants§
TaskNotFound
Task not found in the task store. JSON-RPC: -32001, HTTP: 404
TaskNotCancelable
Task cannot be canceled because it is in a terminal state. JSON-RPC: -32002, HTTP: 409
PushNotificationNotSupported
Agent does not support push notifications. JSON-RPC: -32003, HTTP: 400
UnsupportedOperation
A valid method was called but the agent does not support it. JSON-RPC: -32004, HTTP: 400
ContentTypeNotSupported
A media type in the request is not supported. JSON-RPC: -32005, HTTP: 415
InvalidAgentResponse
The agent returned a non-conformant response. JSON-RPC: -32006, HTTP: 502
ExtendedAgentCardNotConfigured
Extended agent card is declared but not configured. JSON-RPC: -32007, HTTP: 400
ExtensionSupportRequired
A required extension is not declared by the client. JSON-RPC: -32008, HTTP: 400
VersionNotSupported
Requested protocol version is not supported. JSON-RPC: -32009, HTTP: 400
InvalidParams
Request parameters failed validation. JSON-RPC: -32602, HTTP: 400
Internal
Unexpected server-side failure. JSON-RPC: -32603, HTTP: 500
MethodNotFound
Requested JSON-RPC method is not recognized. JSON-RPC: -32601, HTTP: 404
InvalidStateTransition
Attempted an invalid task state transition. JSON-RPC: -32603, HTTP: 409
PushDeliveryFailed
Push notification webhook delivery failed after retries. JSON-RPC: -32603, HTTP: 500
Implementations§
Source§impl A2aError
impl A2aError
Sourcepub fn json_rpc_code(&self) -> i32
pub fn json_rpc_code(&self) -> i32
Map to JSON-RPC error code per A2A v1.0.0 spec §5.4.
Sourcepub fn http_status(&self) -> u16
pub fn http_status(&self) -> u16
Map to HTTP status code per A2A v1.0.0 spec §5.4.
Sourcepub fn to_error_info(&self) -> Value
pub fn to_error_info(&self) -> Value
Produce google.rpc.ErrorInfo data per spec §9.5.
Returns a JSON array containing a single google.rpc.ErrorInfo object
with @type, reason (UPPER_SNAKE_CASE, no “Error” suffix), domain,
and variant-specific metadata.
Sourcepub fn to_jsonrpc_error(&self) -> Value
pub fn to_jsonrpc_error(&self) -> Value
Produce a JSON-RPC error object: { "code": ..., "message": ..., "data": <error_info> }.
Sourcepub fn to_http_error_response(&self) -> Value
pub fn to_http_error_response(&self) -> Value
Produce an AIP-193 HTTP error response.
{
"error": {
"code": 404,
"status": "NOT_FOUND",
"message": "Task not found: task_abc123",
"details": [<error_info>]
}
}Trait Implementations§
Source§impl Error for A2aError
impl Error for A2aError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()