Skip to content

fix(server): send REST errors as application/json - #455

Merged
muscariello merged 1 commit into
stack/03-inmemory-task-store-limitfrom
stack/03a-rest-error-media-type
Nov 2, 2026
Merged

muscariello merged 1 commit into
stack/03-inmemory-task-store-limitfrom
stack/03a-rest-error-media-type

Conversation

@muscariello

Copy link
Copy Markdown
Member

Fixes #454. Stacked on #441: review only the last commit.

Cause: rest_error_response labelled its google.rpc.Status error body application/problem+json. The Go and .NET clients read an error body only from application/json (Go also from application/a2a+json), so against this server they lost the ErrorInfo reason: Go read TASK_NOT_FOUND as ErrMethodNotFound, .NET read TASK_NOT_CANCELABLE as InvalidRequest.

Fix: errors use axum's default application/json; successes stay application/a2a+json. a2aproject/A2A#1689 proposes the same for the spec.

Placement: below #443 on purpose. The version errors (#443), stream errors (#449) and rejections (#451) are all built on the final media type, so none of them changes it later. #449 and #451 were adjusted to follow: the error function #449 refactors and one assertion in #451's test.

Tests: the content-type test is renamed and asserts application/json. The Go v2.7.0 and a2a-dotnet clients were also run against the example server before and after: typed errors come back only after.

Unproven: the Python client was not checked.

rest_error_response labelled its google.rpc.Status body
application/problem+json, after the spec's worked examples. The Go and
.NET clients read an error body only from application/json (Go also
from application/a2a+json), so against this server they lost the
ErrorInfo reason and mapped the error from the HTTP status alone. The
body is not an RFC 9457 problem document either. Errors now use axum's
default application/json; success responses stay application/a2a+json.

Fixes: #454
Signed-off-by: Luca Muscariello <[email protected]>
@codecov

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@muscariello
muscariello added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit e62d34e Nov 2, 2026
22 checks passed
@muscariello
muscariello deleted the stack/03a-rest-error-media-type branch November 2, 2026 17:44
@github-actions github-actions Bot mentioned this pull request Nov 2, 2026
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.

[Bug]: HTTP+JSON errors are sent as application/problem+json, which the Go and .NET clients do not read as A2A errors

2 participants