a2a-java icon indicating copy to clipboard operation
a2a-java copied to clipboard

fix: UnsupportedOperationError gRPC status should be FAILED_PRECONDITION per spec

Open kabir opened this issue 3 months ago • 2 comments

Problem

The A2A specification (section 5.4) defines the following gRPC status mapping for UnsupportedOperationError:

A2A Error Type JSON-RPC Code gRPC Status HTTP Status
UnsupportedOperationError -32004 FAILED_PRECONDITION 400 Bad Request

However, A2AErrorCodes.UNSUPPORTED_OPERATION in the SDK maps to UNIMPLEMENTED:

https://github.com/a2aproject/a2a-java/blob/643f1f803e992892b1bac89c8ccfb9481e563141/spec/src/main/java/org/a2aproject/sdk/spec/A2AErrorCodes.java#L29

UNSUPPORTED_OPERATION(-32004, "UNIMPLEMENTED", 400),

This diverges from the spec table, which says the gRPC status should be FAILED_PRECONDITION.

Expected behavior

UNSUPPORTED_OPERATION should map to gRPC FAILED_PRECONDITION to match the spec.

Context

Found during review of #1041, which correctly changed streaming-not-supported errors from InvalidRequestError to UnsupportedOperationError. The gRPC status mismatch is a pre-existing issue unrelated to that PR.

kabir avatar Aug 11 '26 10:08 kabir

I reproduced this on current main (643f1f80). I updated only the existing gRPC assertions for paths that emit UnsupportedOperationError and ran:

mvn -pl transport/grpc -am -Dtest=GrpcHandlerTest -Dsurefire.failIfNoSpecifiedTests=false test

All 8 affected paths failed consistently with expected: <FAILED_PRECONDITION> but was: <UNIMPLEMENTED> (42 tests total, 34 unaffected tests passed). I am working on the minimal mapping/test/doc update.

dangzitou avatar Aug 12 '26 18:08 dangzitou

Closing as per https://github.com/a2aproject/a2a-java/pull/1059#issuecomment-5341719508

kabir avatar Aug 19 '26 14:08 kabir