-
Notifications
You must be signed in to change notification settings - Fork 934
Open
Description
Environment
- Package:
ag_ui_adk - ADK:
google.adk - Python: 3.12
Bug Description
runner.run_async() raises ValueError when both invocation_id and new_message are None. This occurs intermittently when there's no message_batch and no user messages to process.
Error Log
Background execution error: Both invocation_id and new_message are None.
Traceback (most recent call last):
File "...\ag_ui_adk\adk_agent.py", line 1232, in _run_adk_in_background
async for adk_event in runner.run_async(**run_kwargs):
File "...\google\adk\runners.py", line 443, in run_async
async for event in agen:
File "...\google\adk\runners.py", line 382, in _run_with_trace
raise ValueError('Both invocation_id and new_message are None.')
ValueError: Both invocation_id and new_message are None.
Root Cause
In adk_agent.py → _run_adk_in_background:
# Line 1080
user_message = await self._convert_latest_message(input, unseen_messages) if message_batch else None
# Line 1186-1188 (else branch)
else:
new_message = user_message # Can be None
# Line 1225-1232
run_kwargs = {
"user_id": user_id,
"session_id": input.thread_id,
"new_message": new_message, # None
"run_config": run_config
# invocation_id is NOT included
}
async for adk_event in runner.run_async(**run_kwargs): # Raises errorCondition:
message_batch=None→user_message=Noneactive_tool_results=Noneor empty- Falls to
elsebranch →new_message=None invocation_idnot inrun_kwargs- ADK receives both as
None→ raises error
Suggested Fix
Add validation before calling runner.run_async():
# Before line 1225
if new_message is None:
logger.warning(
f"No new_message to process for thread {input.thread_id}, skipping ADK execution"
)
await event_queue.put(None) # Signal completion
returnAffected File
ag_ui_adk/adk_agent.py ~ line 1225
xomanova, tianshi04 and yuvalcohenrise
Metadata
Metadata
Assignees
Labels
No labels