Skip to content

fix(rest): find the A2A ErrorInfo anywhere in the error details - #1385

Merged
kabir merged 1 commit into
a2aproject:mainfrom
suvvvv:fix-rest-error-info-position
Dec 3, 2026
Merged

kabir merged 1 commit into
a2aproject:mainfrom
suvvvv:fix-rest-error-info-position

Conversation

@suvvvv

@suvvvv suvvvv commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #1384

RestErrorMapper took the error reason from the first entry of error.details only. The HTTP+JSON binding (§11.6) recommends google.rpc.BadRequest for validation errors and allows further detail objects without fixing their order, so an ErrorInfo after another detail was ignored and the error became a generic A2AClientHTTPError. An ErrorInfo of another domain in first position was also taken as the A2A error.

Change

extractReasonAndMetadata now looks through every detail for the type.googleapis.com/google.rpc.ErrorInfo of the a2a-protocol.org domain, as GrpcErrorMapper.extractErrorInfo does. Without one it uses the first detail that has a reason, so bodies without @type or domain (as in testRecognizedA2AErrorDoesNotWrapInHttpError) are still mapped.

Tests

New in RestErrorMapperTest:

  • BadRequest before the A2A ErrorInfo maps to InvalidParamsError, with the ErrorInfo metadata as details.
  • an ErrorInfo of another domain before the A2A one maps to TaskNotCancelableError, not TaskNotFoundError.

Both fail on main. Dropping the domain check fails the second one, and dropping the fallback fails the existing testRecognizedA2AErrorDoesNotWrapInHttpError. client/transport/rest: 80 tests pass, and spotless:check is clean.

RestErrorMapper read the reason only from the first entry of
error.details. The HTTP+JSON binding allows other detail types, such as
google.rpc.BadRequest, in any order, so an ErrorInfo after another
detail was ignored and the error became a generic A2AClientHTTPError.

Look for the ErrorInfo of the a2a-protocol.org domain in every detail,
as GrpcErrorMapper does, and fall back to the first detail with a
reason.

Fixes a2aproject#1384
@kabir

kabir commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Retriggered the tests

@kabir
kabir merged commit e08a4ac into a2aproject:main Dec 3, 2026
14 of 18 checks passed
@kabir

kabir commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Thanks @suvvvv !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST client only reads ErrorInfo from the first error detail

2 participants