Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug]: A2A exceptions lost their structured __repr__ after the client error refactor (#761)

Aperta
#1,347 0 commenti 0 reazioni 2 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@rohityan ci sta già lavorando.

Dal 16/10/2026.

  • #1348 di @cchinchilla-dev — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

What happened?

#683 (for #679) added structured __repr__ methods to the client exception classes. The client error refactor in #761 replaced those classes with the new A2AError-based hierarchy (src/a2a/utils/errors.py, src/a2a/client/errors.py), and the __repr__ methods were not carried over.

Exceptions now fall back to the default Exception.__repr__, which only wraps str() output and loses structured attributes. Since server and client errors share A2AError, this affects both sides:

>>> repr(AgentCardResolutionError('Failed to fetch agent card', status_code=404))
"AgentCardResolutionError('Failed to fetch agent card')"  # Loses status_code

>>> repr(InvalidParamsError('Invalid field', data={'field': 'id'}))
"InvalidParamsError('Invalid field')"  # Loses data

Suggested fix: add __repr__ to A2AError, so every domain and client error inherits it, and override it in AgentCardResolutionError, following the same pattern as #683:

# A2AError
def __repr__(self) -> str:
    return (
        f'{self.__class__.__name__}('
        f'message={self.message!r}, '
        f'data={self.data!r})'
    )

# AgentCardResolutionError
def __repr__(self) -> str:
    return (
        f'{self.__class__.__name__}('
        f'status_code={self.status_code!r}, '
        f'message={self.message!r})'
    )

This does not alter __str__ output, traceback formatting, exception hierarchy or catching behavior.

If dropping __repr__ in #761 was intentional, I may be missing some context. In that case, feel free to close this.

I have a fix ready and I'm opening a PR alongside this issue.

Code of Conduct
  • I agree to follow this project's Code of Conduct
Lingua principale
Python
Stelle
2.2k
Fork
511
Merge medio
3g 10h
PR unite (30g)
47

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di a2aproject/a2a-python

Tutte le issue di a2aproject/a2a-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.