Repository navigation
Description
What happened?
grpc_handler.py's _ERROR_CODE_MAP (src/a2a/server/request_handlers/grpc_handler.py:84-98) maps 3 of the 9 A2A error types to the wrong gRPC status code, diverging from the canonical binding table in the spec (specification.md "Custom Binding Requirements" / error-code-mappings section):
| A2A Error Type | Spec gRPC Status | SDK gRPC Status |
|---|---|---|
PushNotificationNotSupportedError |
UNIMPLEMENTED |
FAILED_PRECONDITION ❌ |
UnsupportedOperationError |
UNIMPLEMENTED |
FAILED_PRECONDITION ❌ |
VersionNotSupportedError |
UNIMPLEMENTED |
FAILED_PRECONDITION ❌ |
_ERROR_CODE_MAP: dict[type[A2AError], grpc.StatusCode] = {
...
types.PushNotificationNotSupportedError: grpc.StatusCode.FAILED_PRECONDITION,
types.UnsupportedOperationError: grpc.StatusCode.FAILED_PRECONDITION,
...
types.VersionNotSupportedError: grpc.StatusCode.FAILED_PRECONDITION,
}The other 6 mappings (TaskNotFoundError, TaskNotCancelableError, ContentTypeNotSupportedError, InvalidAgentResponseError, ExtendedAgentCardNotConfiguredError, ExtensionSupportRequiredError) are all correct against the same table.
Second, related bug: gRPC transport doesn't validate A2A-Version at all
jsonrpc_dispatcher.py and rest_dispatcher.py both guard their handlers with @validate_version(constants.PROTOCOL_VERSION_1_0), which raises VersionNotSupportedError for an unsupported A2A-Version. grpc_handler.py has no equivalent — a SendMessage gRPC call with metadata a2a-version: 99.0 is processed normally instead of being rejected. Per spec (specification.md:739): "Agents MUST process requests using the semantics of the requested A2A-Version... If the version is not supported by the interface, agents MUST return a VersionNotSupportedError."
Reproduction
Against a standard DefaultRequestHandlerV2-backed gRPC server:
import grpc
metadata = [("a2a-version", "99.0")]
client.stub.SendMessage(proto_request, metadata=metadata)
# succeeds — no VersionNotSupportedError, no version check at allFor the status-code mismatch, trigger any PushNotificationNotSupportedError (e.g. call CreatePushNotificationConfig when capabilities.push_notifications is false) over gRPC and inspect e.code() — it's FAILED_PRECONDITION, not UNIMPLEMENTED.
We hit both while running the official a2a-tck MUST-level gRPC suite against a reference SUT built on this SDK — GRPC-ERR-002 fails on test_push_not_supported_returns_unimplemented and test_version_not_supported_returns_unimplemented for exactly these reasons.
Expected
- Fix the 3 entries in
_ERROR_CODE_MAPtoUNIMPLEMENTED, matching the other 6 and the spec table. - Apply the same version-validation the HTTP dispatchers already do to the gRPC transport (a
@validate_version-equivalent, or an explicit check inGrpcHandlerreading thea2a-versionmetadata key).
Happy to send a PR for both if useful.
Activity
avilleroy51 commentedon Aug 6, 2026
Fixed in #1167.
fix(grpc): correct error code mapping and enforce A2A-Version validation
rohityan commentedon Aug 12, 2026
Hi @avilleroy51 , Thank you for reporting this and contributing in #1167 to fix this. Your diagnosis of the issue is accurate.
In your fix within
_validate_a2a_version(), if a user supplies a customGrpcServerCallContextBuilderthat does not populatestate['headers'], it currently defaults to'0.3'and would reject valid 1.0 requests. Consider adding a fallback to readinvocation_metadata()directly fromserver_context.state.get('grpc_context')ifheadersis missing.Also could you add unit tests in
test_grpc_handler.pyexplicitly asserting that an incompatible version (e.g. a2a-version: 99.0) or an absent version metadata properly triggersVersionNotSupportedError / StatusCode.UNIMPLEMENTED.Assigning this issue to you till the PR gets reviewed.
mykytanetipa commentedon Aug 20, 2026
Spec PR a2aproject/A2A#1627 merged 2026-04-14 and shipped in v1.0.1 reverted PushNotificationNotSupportedError, UnsupportedOperationError, and VersionNotSupportedError from UNIMPLEMENTED back to FAILED_PRECONDITION.
Current spec shows FAILED_PRECONDITION for all three which is what grpc_handler._ERROR_CODE_MAP already has (please refer to the https://github.com/a2aproject/A2A/blob/v1.0.1/docs/specification.md). The UNIMPLEMENTED table you cited is the older v1.0.0 revision.
github-actions commentedon Sep 3, 2026
Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs.
github-actions commentedon Sep 16, 2026
This issue was closed because it has been inactive for 27 days. Please post a new issue if you need further assistance. Thanks!