You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] An error occurred during processing at the end of agent chat #859
I have searched the existing issues to avoid creating a duplicate
By submitting this issue, you agree to follow our Code of Conduct
I am using the latest version of the software
I have tried to clear cache/cookies or used incognito mode (if ui-related)
I can consistently reproduce this issue
🎯 Affected Service(s)
Not Sure
🚦 Impact/Severity
No impact (Default)
🐛 Bug Description
using 0.5.5
This showed up in my demo in AI_Dev live, and pretty easy to reproduce with the AIRE-agent. The PR/Branch did get created not sure why it is reporting an errror. No obvious error in the log other than this in the agent log:
Warning: Error during MCP session cleanup for session_no_headers: Attempted to exit cancel scope in a different task than it was entered in │
│ INFO:google_adk.google.adk.runners:Successfully closed toolset: MCPToolset
🔄 Steps To Reproduce
deploy AIRE-agent
ask it to debug a cluster. In the cluster, i had argo deployed my gen-ai-demo app with path kubernetes.
I used agentgateway as the ingress gw.
🤔 Expected Behavior
No error (everything appears to be working in my case) or a helpful error show to the user.
ADK seems to be setting the error_code erroneously if there are no results. However, it seems as though Gemini in this case is returning no results which is interpreted as an error, and ends up bubbling up as one.
When using kagent chat in multi-turn conversations, the following error also occurs:
WARNING:google_adk.kagent.adk._agent_executor:Runner.close() was cancelled; suppressing during cleanup
Warning: Error during MCP session cleanup for session_no_headers: Attempted to exit cancel scope in a different task than it was entered in
ERROR:mcp.client.streamable_http:Error parsing SSE message
Traceback (most recent call last):
File "/.kagent/python/.venv/lib/python3.13/site-packages/mcp/client/streamable_http.py", line 174, in _handle_sse_event
await read_stream_writer.send(session_message)
File "/.kagent/python/.venv/lib/python3.13/site-packages/anyio/streams/memory.py", line 243, in send
self.send_nowait(item)
~~~~~~~~~~~~~~~~^^^^^^
File "/.kagent/python/.venv/lib/python3.13/site-packages/anyio/streams/memory.py", line 212, in send_nowait
raise ClosedResourceError
anyio.ClosedResourceError
Warning: Error during MCP session cleanup for session_no_headers: Attempted to exit cancel scope in a different task than it was entered in
Activity
linsun commentedon Sep 4, 2025
cc @EItanya
linsun commentedon Sep 4, 2025
EItanya commentedon Sep 4, 2025
Here is a task history for more data:
Notice that following the function call there is an adk_error_code: STOP.
However, after digging into the code it seems as though this is a bug with ADK. After digging into the ADK code I found the following bit: https://github.com/google/adk-python/blob/14484065c64396cebc4a1dde84d6b8b51439b990/src/google/adk/models/llm_response.py#L122. Specifically when paired with the A2A conversion code: https://github.com/google/adk-python/blob/14484065c64396cebc4a1dde84d6b8b51439b990/src/google/adk/a2a/converters/event_converter.py#L382-L387.
ADK seems to be setting the
error_codeerroneously if there are no results. However, it seems as though Gemini in this case is returning no results which is interpreted as an error, and ends up bubbling up as one.VinncentZHZ commentedon Sep 5, 2025
When using kagent chat in multi-turn conversations, the following error also occurs:
WARNING:google_adk.kagent.adk._agent_executor:Runner.close() was cancelled; suppressing during cleanup
Warning: Error during MCP session cleanup for session_no_headers: Attempted to exit cancel scope in a different task than it was entered in
ERROR:mcp.client.streamable_http:Error parsing SSE message
Traceback (most recent call last):
File "/.kagent/python/.venv/lib/python3.13/site-packages/mcp/client/streamable_http.py", line 174, in _handle_sse_event
await read_stream_writer.send(session_message)
File "/.kagent/python/.venv/lib/python3.13/site-packages/anyio/streams/memory.py", line 243, in send
self.send_nowait(item)
~~~~~~~~~~~~~~~~^^^^^^
File "/.kagent/python/.venv/lib/python3.13/site-packages/anyio/streams/memory.py", line 212, in send_nowait
raise ClosedResourceError
anyio.ClosedResourceError
Warning: Error during MCP session cleanup for session_no_headers: Attempted to exit cancel scope in a different task than it was entered in
EItanya commentedon Sep 10, 2025
This issue was fixed by #875