Skip to content

fix(errors): emit JSON-RPC error.data as typed-details array per A2A 1.0 spec hot-fix#1058

Open
sokoliva wants to merge 6 commits intoa2aproject:mainfrom
sokoliva:update-error-format
Open

fix(errors): emit JSON-RPC error.data as typed-details array per A2A 1.0 spec hot-fix#1058
sokoliva wants to merge 6 commits intoa2aproject:mainfrom
sokoliva:update-error-format

Conversation

@sokoliva
Copy link
Copy Markdown
Member

@sokoliva sokoliva commented May 7, 2026

Description

Aligns the JSON-RPC and REST transports with the A2A 1.0 spec hot-fix which makes error.data (JSON-RPC) and
error.details (REST) carry an array of typed-detail objects using the ProtoJSON Any representation.

Server side

build_error_response and build_rest_error_payload now emit a leading google.rpc.ErrorInfo carrying the canonical A2A reason and error.data as metadata. For InvalidParamsError with validation details, both transports also append a google.rpc.BadRequest

Client side

The JSON-RPC client now extracts ErrorInfo.metadata from the array onto A2AError.data.

Also adds the missing JSONParseError(-32700) exception class so JSON-RPC clients receive a typed exception for the standard parse-error code instead of falling back to a generic A2AClientError.

Fixes #1027. 🦕

@sokoliva sokoliva requested a review from a team as a code owner May 7, 2026 08:49
@sokoliva sokoliva requested a review from ishymko May 7, 2026 08:49
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request standardizes error responses across REST and JSON-RPC transports by introducing a structured error details format. It adds a build_error_details utility to generate google.rpc.ErrorInfo and google.rpc.BadRequest objects, ensuring consistent field-level violation reporting. The JSON-RPC client was also updated to correctly extract metadata from this new format. Feedback recommends adding the new JSONParseError class, the build_error_details function, and associated constants to the __all__ export list in src/a2a/utils/errors.py to properly expose them as part of the public API.

Comment thread src/a2a/utils/errors.py
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/client/transports/jsonrpc.py 91.39% 93.29% 🟢 +1.90%
src/a2a/utils/error_handlers.py 96.05% 96.67% 🟢 +0.61%
Total 93.03% 93.08% 🟢 +0.05%

Generated by coverage-comment.yml

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.

[Task]: Update JSON-RPC error format according to the latest spec changes

1 participant