Empty response and UNKNOWN_ERROR
I randomly receive empty response from LLM followed by UNKNOWN_ERROR. The pattern I see is that this happens when agent 1. answer with text, 2. calls the tool and gets the result 3. Want to provide follow up message to the user.
Sometimes it works perfect, and sometimes I receive empty answer like this:
LLM Response:
Text: None
Function calls:
Raw response: {"model_version":"gemini-2.5-pro-preview-03-25","usage_metadata":{"prompt_token_count":9314,"prompt_tokens_details":[{"modality":"TEXT","token_count":9314}],"total_token_count":9314},"automatic_function_calling_history":[]}
Which later is followed by event with UNKNOWN_ERROR:
INFO | google.adk.sessions.database_session_service:append_event:439 - Append event: content=None grounding_metadata=None partial=None turn_complete=None error_code='UNKNOWN_ERROR' error_message='Unknown error.' interrupted=None custom_metadata=None invocation_id='e-7b409bad-ccfd-410c-ace1-424df582e296' author='host_agent' actions=EventActions(skip_summarization=None, state_delta={'artifact_list': ['user:app_profile.json', 'user:user_profile.json']}, artifact_delta={}, transfer_to_agent=None, escalate=None, requested_auth_configs={}) long_running_tool_ids=None branch=None id='ahgJFXKb' timestamp=1746279733.766547 to session 0ddb7351-375a-4007-a983-f4dd768b4870 - {}
Python 3.11.11 Name: google-adk Version: 0.3.0
@mrmza can you provide the code snippet for debugging?
I also sometimes randomly get empty messages like the one in this issue. I can't find a consistent way of reproducing it though
Version: 0.5.0 I'm experiencing the same problem. Any solutions or workarounds discovered so far? @mrmza
I think this is due to model occasionally generate response with empty content. We previously had a fix for it in https://github.com/google/adk-python/commit/d387ab0c3807c2a8db725145a90d63367e0ff1cc.
Feel free to reopen and let us know if you still see it in 1.0.0+
@Jacksunwei , I have been facing this issue recently, google-adk version 1.23.0
same issues
adk/js
"@google/adk": "^1.1.0"
"@google/adk-devtools": "^1.1.0"