[Bug]: A2ACardResolver.get_agent_card raises UnicodeDecodeError and RecursionError instead of AgentCardResolutionError
I maintainer di solito rispondono entro 2 giorni
@rohityan ci sta già lavorando.
Dal 16/11/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
What happened?
A2ACardResolver.get_agent_card() documents AgentCardResolutionError when "the response body cannot be decoded as JSON", and #1307 made the parser side keep that promise. Two bodies still escape as builtins, because the except clauses catch only json.JSONDecodeError: a card served as Latin-1 raises UnicodeDecodeError, and a deeply nested body raises RecursionError. A caller that handles AgentCardResolutionError around card discovery gets an unhandled exception from a remote agent's bad card.
Reproduced on caab6a2 (main), Python 3.10.21, httpx 0.28.1:
import asyncio
import httpx
from a2a.client import A2ACardResolver, AgentCardResolutionError
BODIES = {
'latin-1 body': '{"name": "Café"}'.encode('latin-1'),
'deep nesting': b'{"name": ' + b'[' * 100_000 + b']' * 100_000 + b'}',
}
async def main():
for label, body in BODIES.items():
transport = httpx.MockTransport(lambda _, b=body: httpx.Response(200, content=b))
async with httpx.AsyncClient(transport=transport) as client:
try:
await A2ACardResolver(client, 'http://agent').get_agent_card()
except AgentCardResolutionError as e:
print(label, '-> AgentCardResolutionError')
except Exception as e:
print(label, '->', type(e).__name__, e)
asyncio.run(main())
Expected: both lines print AgentCardResolutionError, the same as a body of [] does today.
Listing UnicodeDecodeError and RecursionError beside json.JSONDecodeError would cover it. A bare ValueError would also swallow one raised by a caller's signature_verifier, which runs in the same try. I only checked the 1.0 resolver, not the v0.3 compat path. Happy to open the pull request with a MockTransport test for each body if that fix works for you.
Relevant log output
$ python repro.py
latin-1 body -> UnicodeDecodeError 'utf-8' codec can't decode byte 0xe9 in position 13: invalid continuation byte
deep nesting -> RecursionError maximum recursion depth exceeded while decoding a JSON array from a unicode string
Code of Conduct
- I agree to follow this project's Code of Conduct
- Lingua principale
- Python
- Stelle
- 2.2k
- Fork
- 540
- Merge medio
- 2g 10h
- PR unite (30g)
- 57
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di a2aproject/a2a-python
-
[Bug]: REST task/request id sanitizationForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertamaintainers-only
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
a2aproject/a2a-python#805 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: v0.3 JSON-RPC `tasks/pushNotificationConfig/delete` succeeds with no `result` memberForse già presa @rohityan l’ha presa 1 giorno fa. Aperta
a2aproject/a2a-python#1480 · 2 assegnatari ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: JSON-RPC client ignores the JSON-RPC error body when the HTTP status is not 2xxForse già presa @rohityan l’ha presa 1 giorno fa. Aperta
a2aproject/a2a-python#1475 · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
[Feat]: validate_input_modes: match media ranges such as image/* declared in the agent cardForse già presa @rohityan l’ha presa 3 giorni fa. Apertacomponent: core status:awaiting response
a2aproject/a2a-python#1468 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
Required extensions aren't enforced, so ExtensionSupportRequiredError is never raisedForse già presa @rohityan l’ha presa 4 giorni fa. Apertacomponent: server status:awaiting response
a2aproject/a2a-python#1467 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di a2aproject/a2a-python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
readthedocs/readthedocs-builder#73 ·
I maintainer di solito rispondono entro 1 giorno
-
area: ci bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
hffgzktbcc-blip/ounce-core#484 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
vllm-project/vllm-torchtpu#3395 ·
I maintainer di solito rispondono entro 1 giorno
-
Hermes plugin: MITM-domain discovery misses the model: block (provider/base_url nested under model:) — traffic blind-tunnels silently, zero compressionForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
ranxianglei/billion-context#7063 ·
I maintainer di solito rispondono entro 1 giorno