From e604106ab3460b0220cd4e5a0c5355ece0b31df3 Mon Sep 17 00:00:00 2001 From: Ivan Shymko Date: Tue, 17 Feb 2026 16:26:16 +0000 Subject: [PATCH] fix: properly handle errors in list_tasks JSON-RPC --- src/a2a/server/request_handlers/jsonrpc_handler.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/a2a/server/request_handlers/jsonrpc_handler.py b/src/a2a/server/request_handlers/jsonrpc_handler.py index d2c502023..2ddad056a 100644 --- a/src/a2a/server/request_handlers/jsonrpc_handler.py +++ b/src/a2a/server/request_handlers/jsonrpc_handler.py @@ -400,11 +400,9 @@ async def list_tasks( """ try: result = await self.request_handler.on_list_tasks(request, context) - except ServerError: - return ListTasksResponse( - # This needs to be appropriately handled since error fields on proto messages - # might be different from the old pydantic models - # Ignoring proto error handling for now as it diverges from the current pattern + except ServerError as e: + return _build_error_response( + request_id, e.error if e.error else InternalError() ) return result