Skip to main content

A2aError

Enum A2aError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

§

OwnershipUnavailable

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).

§

Unauthorized(String)

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).

Fields

§since_id: u64

Cursor the caller supplied.

§

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.

Fields

§source: Box<dyn Error + Send + Sync>

Underlying typed cause, preserved for Error::source().

§

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

§code: i32

The peer’s verbatim JSON-RPC error code — branch on it for the wire-level cause (e.g. -32601 method-not-found, -32000 server).

§message: String

The peer’s verbatim error message; treat as untrusted display text (it originated on the remote side).

§

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.

Fields

§stream_id: String

Leader-registry stream id (e.g. a2a.t-1) so the client can correlate with bus telemetry.

Implementations§

Source§

impl A2aError

Source

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 Debug for A2aError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for A2aError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for A2aError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BusError> for A2aError

Source§

fn from(source: BusError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for A2aError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more