Skip to content

[Bug]: HTTP+JSON error mapping is incorrect for ContentTypeNotSupportedError & VersionNotSupportedError #730

@jmesnil

Description

@jmesnil

What happened?

Summary

The HTTP+JSON transport returns incorrect HTTP status codes for ContentTypeNotSupportedError (404 instead of 415) and VersionNotSupportedError (501 instead of 400 with missing Problem Details type field).

Requirement

Specification

All A2A-specific errors defined in Section 3.3.2 MUST be mapped to binding-specific error representations. The following table provides the canonical mappings for each standard protocol binding:

A2A Error Type HTTP Status
ContentTypeNotSupportedError 415 Unsupported Media Type
VersionNotSupportedError 400 Bad Request

Expected behavior

  1. When a request is sent with an unsupported Content-Type (e.g., text/plain), the server MUST return HTTP 415 with a Problem Details body whose type is https://a2a-protocol.org/errors/content-type-not-supported.

  2. When a request includes an unsupported A2A-Version header (e.g., 99.0), the server MUST return HTTP 400 with a Problem Details body whose type is https://a2a-protocol.org/errors/version-not-supported.

Actual behavior

  1. ContentTypeNotSupportedError: Server returns 404 Not Found instead of 415.
  2. VersionNotSupportedError: Server returns 501 Not Implemented without a Problem Details type field, instead of 400 with proper Problem Details.

The missing type field has already been reported in #727.

Reproducer

# 1. ContentTypeNotSupportedError — expect 415, got 404
curl -s -o /dev/null -w "%{http_code}" \
  -X POST http://localhost:9999/message:send \
  -H "Content-Type: text/plain" \
  -d '{"message": {"role": "ROLE_USER", "parts": [{"text": "ct test"}], "messageId": "tck-status-ct-004"}}'
# Expected: 415
# Actual:   404

# 2. VersionNotSupportedError — expect 400 with Problem Details, got 501
curl -s -X POST http://localhost:9999/message:send \
  -H "Content-Type: application/json" \
  -H "A2A-Version: 99.0" \
  -d '{"message": {"role": "ROLE_USER", "parts": [{"text": "version status test"}], "messageId": "tck-status-ver-006"}}'
# Expected: 400 with {"type": "https://a2a-protocol.org/errors/version-not-supported", ...}
# Actual:   501 with no 'type' field in response body

TCK tests

  • tests/compatibility/http_json/test_http_status.py::TestHttpJsonStatusCodes::test_content_type_not_supported_returns_415
  • tests/compatibility/http_json/test_http_status.py::TestHttpJsonStatusCodes::test_version_not_supported_returns_400

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

compatibilityIssue related to A2A compatibilityhttp+jsonIssue related to the HTTP+JSON transport

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions