Skip to content

[Bug]: a2av0 JSON-RPC client fails to decode v0.3 error responses with non-typed data, masking the real error #385

Description

@LutzLange

Title: [Bug]: a2av0 JSON-RPC client fails to decode v0.3 error responses with non-typed data, masking the real error

Summary

The a2av0 compat JSON-RPC transport decodes responses into the shared jsonrpc.ClientResponse, whose Error.Data is typed []*errordetails.Typed (internal/jsonrpc/jsonrpc.go:54-58). JSON-RPC 2.0 / A2A v0.3 define error.data as any JSON value, and v0.3 servers commonly return an object there. When they do, the whole Decode(&resp) fails, so the caller gets failed to decode response: json: cannot unmarshal object into Go struct field ... instead of the server's error — code and message are lost along with the data.

Current behavior

  • a2acompat/a2av0/jsonrpc_client.go sendRequest (~line 127): json.NewDecoder(httpResp.Body).Decode(&resp) with resp jsonrpc.ClientResponse → any v0.3 error whose data is not []*errordetails.Typed aborts the decode.
  • Same on the SSE streaming path (~lines 165-175).
  • Present in v2.3.1 and current main.

Repro

Point an a2av0 JSON-RPC client at a v0.3 server that returns:

{"jsonrpc":"2.0","id":"1","error":{"code":-32603,"message":"real error message","data":{"reason":"detail"}}}

Client surfaces failed to decode response (callers typically wrap this as internal error / -32603); the real message never reaches the caller.

Requested

Decode error.data leniently in the v0 transport (json.RawMessage/any), always preserve code + message, and convert to typed details only when they parse. Same bug class as #318 (REST streaming error events), applied to the JSON-RPC v0 path.

Workarounds

None at the SDK consumer level; the decode failure happens inside the transport.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions