bug: JSON-RPC errors drop the server's 401 and 503 message, showing only the HTTP status

Open Beginner friendly
#158 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, json
Domain
api

Research direction

The JSON-RPC client in a2aclient/jsonrpc.go (around lines 124-125 and 156-157) returns on any non-200 status without reading the body, and the cause is the a2a-go v2.6.0 dependency. Start by checking go.mod and bumping a2a-go to a version whose internal/jsonrpc FromHTTPError parses the error body. Done when a2a send against a 401 or 503 prints the server's message instead of only the HTTP status, matching the output of --transport rest.

Written by the indexing model from the issue text.

Description

Over the default JSON-RPC transport, a2a send and a2a task list print only unexpected HTTP status: 401 Unauthorized or 503 Service Unavailable. They drop the server's error message, so a new user gets no instruction from the CLI.

Repro (against a2a-serve)

a2a send -a "$URL" "hi"                     # no token, or a revoked or rotated pairing
a2a send -a "$URL" --transport rest "hi"

Expected

The server's A2A error, which a2a-serve sends in the 401 body: this agent needs a token: on the machine running the agent, enable the credential helper of a2a-serve (run a2a-serve doctor --fix); elsewhere, ask the agent's owner for a pairing code and run a2a-serve pair join ``. For 503: "the server is busy; try again later".

Actual

Error: failed to send message: unexpected HTTP status: 401 Unauthorized (exit 1; -o json gives A2ACLI_ERR_INTERNAL), also with -v. --transport rest prints the full hint. This hits example 01 of a2a-serve when a2a-serve doctor --fix was skipped, and every member whose pairing was rotated or removed. It reproduced in 3 lanes, more than 10 times in total.

Cause

a2a v0.4.0 is built with a2a-go v2.6.0 (go version -m). Its JSON-RPC client (a2aclient/jsonrpc.go:124-125, :156-157) returns on any non-200 status without decoding the body. Newer a2a-go parses it in internal/jsonrpc/jsonrpc.go:150-164 (FromHTTPError), so bumping a2a-go should fix it.

Found by user simulation (tools/sim) at 1b67edf.

Dominant language
Go
Stars
181
Forks
28
Avg merge
2d 11h
Merged PRs (30d)
22

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from a2aproject/a2a-cli

All issues in a2aproject/a2a-cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.