[Bug]: raised InvalidAgentResponseError
@rohityan is already working on this.
Since Jun 23, 2026.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Domain
- ai-infra-agents
Research direction
The error originates in a2a/server/agent_execution/active_task.py lines 179 and 198. Examine the _handle_message_event method and the InvalidAgentResponseError. Review the specification to understand the intended relationship between tasks and messages. Check how messages are created and associated with tasks in the request handler flow, particularly in default_request_handler_v2.py around line 242.
Written by the indexing model from the issue text.
Description
What happened?
If you create a task when the agent receives a query and you want to return the response as a Message with the task associated, you will get the following error:
InvalidAgentResponseError: Received Message object in task mode. Use TaskStatusUpdateEvent or TaskArtifactUpdateEvent instead.
It looks an architectural decision but into specification we can associate a task with message.
My idea was to retrieve the Message when I run a single call and TaskArtifacts during streaming operation. The diagram flows inside the specification shows that you can associate a task to the Message.
Relevant log output
[ERROR] 2026-06-23 16:28:46 - Consumer[c5185e3b-e7b9-49d9-a078-85ee5c496b0d]: Failed (active_task:140)
Traceback (most recent call last):
File "a2a/server/agent_execution/active_task.py", line 132, in run
await self._process_event(event)
File "a2a/server/agent_execution/active_task.py", line 179, in _process_event
self._handle_message_event(event)
File "a2a/server/agent_execution/active_task.py", line 198, in _handle_message_event
raise InvalidAgentResponseError(
a2a.utils.errors.InvalidAgentResponseError: Received Message object in task mode. Use TaskStatusUpdateEvent or TaskArtifactUpdateEvent instead.
[ERROR] 2026-06-23 16:28:46 - Unhandled exception in v0.3 JSONRPCAdapter (jsonrpc_adapter:142)
Traceback (most recent call last):
File "a2a/compat/v0_3/jsonrpc_adapter.py", line 138, in handle_request
return await self._process_non_streaming_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "a2a/utils/version_validator.py", line 126, in async_wrapper
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "a2a/compat/v0_3/jsonrpc_adapter.py", line 157, in _process_non_streaming_request
res_msg = await self.handler.on_message_send(request_obj, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "a2a/compat/v0_3/request_handler.py", line 30, in on_message_send
task_or_message = await self.request_handler.on_message_send(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "a2a/utils/telemetry.py", line 242, in async_wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "a2a/server/request_handlers/request_handler.py", line 285, in async_wrapper
return await method(self, params, context, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "a2a/server/request_handlers/default_request_handler_v2.py", line 242, in on_message_send
async for raw_event in active_task.subscribe(
File "a2a/server/agent_execution/active_task.py", line 639, in subscribe
raise event
File "a2a/server/agent_execution/active_task.py", line 132, in run
await self._process_event(event)
File "a2a/server/agent_execution/active_task.py", line 179, in _process_event
self._handle_message_event(event)
File "a2a/server/agent_execution/active_task.py", line 198, in _handle_message_event
raise InvalidAgentResponseError(
a2a.utils.errors.InvalidAgentResponseError: Received Message object in task mode. Use TaskStatusUpdateEvent or TaskArtifactUpdateEvent instead.
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 496
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from a2aproject/a2a-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
a2aproject/a2a-python#1261 ·
-
component: server status:awaiting response
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
a2aproject/a2a-python#1237 · 1 comment · 1 assignee ·
-
component: server status:awaiting response status:stale
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
a2aproject/a2a-python#1215 · 2 comments · 1 assignee ·
-
component: server status:awaiting response status:stale
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
a2aproject/a2a-python#1205 · 3 comments · 1 assignee ·
-
component: server status:awaiting response status:stale
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
a2aproject/a2a-python#1204 · 2 comments · 1 assignee ·
All issues in a2aproject/a2a-python
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100