pub enum A2aError {
MethodNotFound,
MethodNotImplemented {
method: A2aMethod,
},
InvalidParams {
reason: String,
},
InternalError {
message: String,
},
AuthenticationRequired,
AuthenticationFailed {
reason: String,
},
ContentTypeNotSupported {
received: String,
},
}Expand description
An A2A-specific error.
The variants are the JSON-RPC error codes the A2A spec names. The serving adapter maps each variant to a code and message on the wire; the consumer never has to know the codes.
§JSON-RPC error codes
-32601:MethodNotFound-32602:InvalidParams-32603:InternalError-32000:ContentTypeNotSupported-32001:AuthenticationRequired-32002:AuthenticationFailed
The negative numbers are the JSON-RPC
standard’s reserved range for “implementation-
defined server errors”; A2A v1.0 §5.3 fixes
these specific codes. The standard
JSON-RPC error codes (-32700 ParseError,
-32600 Invalid Request, -32601
Method Not Found, -32602 Invalid Params, -32603 Internal Error) are
reserved by JSON-RPC itself; the A2A spec
assigns them and extends the
implementation-defined range to -32000
through -32002.
Variants§
MethodNotFound
The method name is not in the A2A
vocabulary. Maps to JSON-RPC -32601.
MethodNotImplemented
The method is known to A2A but the
consumer’s handler does not implement it.
Maps to JSON-RPC -32601 (the same code
as MethodNotFound; the distinction is
for the consumer’s logs).
InvalidParams
The params could not be decoded into the
shape the handler expects. Maps to JSON-RPC
-32602.
Fields
InternalError
The handler failed in a way that is not
the caller’s fault. Maps to JSON-RPC
-32603.
Fields
AuthenticationRequired
The request requires authentication and
the request did not carry credentials.
Maps to JSON-RPC -32001.
AuthenticationFailed
The request carried credentials and they
were not accepted. Maps to JSON-RPC
-32002.
ContentTypeNotSupported
The request’s Content-Type is not
application/json. Maps to JSON-RPC
-32000.
Implementations§
Source§impl A2aError
impl A2aError
Sourcepub const fn code(&self) -> i32
pub const fn code(&self) -> i32
The JSON-RPC error code for this error.
The codes are the A2A v1.0 spec’s
implementation-defined server-error range.
The standard JSON-RPC error codes
(-32700 ParseError, -32600 Invalid
Request, -32601 Method Not Found,
-32602 Invalid Params, -32603
Internal Error) are reserved by
JSON-RPC itself; the A2A spec assigns them
and extends the implementation-defined
range to -32000 through -32002.