#[non_exhaustive]pub enum A2aError {
Show 14 variants
MethodNotFound(String),
InvalidParams(String),
Json(Error),
Bus(BusError),
TaskNotFound(String),
Server(String),
OwnershipUnavailable,
Unauthorized(String),
Misconfigured(String),
ResumeBufferExpired {
since_id: u64,
},
Internal {
source: Box<dyn Error + Send + Sync>,
},
Rpc {
code: i32,
message: String,
},
Timeout(Duration),
LeaderDied {
stream_id: String,
},
}Expand description
Errors returned by the A2A server / handler.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MethodNotFound(String)
JSON-RPC method name not recognised. Maps to JSON-RPC -32601.
InvalidParams(String)
Params payload could not be decoded into the method’s param type. Maps to JSON-RPC -32602.
Json(Error)
JSON parse failure. Maps to JSON-RPC -32700.
Bus(BusError)
Bus-layer failure (subscribe / publish / KV).
TaskNotFound(String)
Task id not present in the store.
Server(String)
Catch-all server-side failure. Maps to JSON-RPC -32000.
The tenant-ownership store was unreachable, or returned an inconclusive verdict, while gating a request under strict tenant binding — the request is denied fail-closed rather than served unprotected. Maps to JSON-RPC -32000; Display is redaction-safe (carries no caller/principal/task detail on the wire — that lives in the server-side log emitted before this is returned).
Authentication or authorisation failure. Maps to A2A-specific -32001.
Misconfigured(String)
The server was started with an invalid or dangerous configuration
(e.g. non-loopback bind with an anonymous authenticator without the
explicit allow_public_bind opt-in). Maps to JSON-RPC -32000.
ResumeBufferExpired
Resume requested with a cursor older than the oldest retained
event in the buffer. Maps to JSON-RPC application code
crate::envelope::codes::RESUME_BUFFER_EXPIRED (-32010).
Internal
Server-side internal failure that preserves the underlying
typed cause via Error::source. Distinct from
A2aError::Server (bare string) because the source chain
matters for tracing.
Maps to JSON-RPC SERVER_ERROR (-32000). Display is the
stable, redaction-safe string "internal error" — the inner
cause is reachable only via Error::source() so callers that
log server-side see the chain while wire envelopes carry no
internal detail. Use for server-internal serialization,
encode, or IPC failures that should NOT be mis-classified as
client-input parse errors.
Rpc
The remote A2A peer answered with a JSON-RPC error envelope.
Raised client-side by crate::client::A2aClient when a reply
carries error instead of result; the code/message are the
peer’s verbatim JSON-RPC error payload so the caller can branch on
the wire code (e.g. -32601 method-not-found, -32000 server error).
Fields
Timeout(Duration)
No reply arrived on the client’s inbox before the per-call
deadline elapsed. Raised client-side by
crate::client::A2aClient; the bus accepted the publish but the
peer never answered (crashed, slow, or wrong agent id).
LeaderDied
Multi-replica orphan: the streaming leader for this task
died (TTL-expired KV claim) or never claimed leadership.
Maps to JSON-RPC application code
crate::envelope::codes::LEADER_DIED (-32099). The
dispatcher writes a terminal frame to the resume buffer
before raising so future resume clients see clean
termination + can retry. ADR-020.
Implementations§
Source§impl A2aError
impl A2aError
Sourcepub fn to_json_rpc_error(&self, request_id: Value) -> JsonRpcResponse
pub fn to_json_rpc_error(&self, request_id: Value) -> JsonRpcResponse
Map this error onto a JsonRpcResponse carrying the matching
JSON-RPC error code.
Trait Implementations§
Source§impl Error for A2aError
impl Error for A2aError
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()