Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Random "MALFORMED_FUNCTION_CALL" Error from Gemini Agent #1521

@onesnzerossc

Description

@onesnzerossc

Describe the bug
Occasionally, when running the agent, I encounter a response with the following error:
Raw response:
{"candidates":[{"content":{},"finish_reason":"MALFORMED_FUNCTION_CALL"}],"model_version":"gemini-2.0-flash","usage_metadata":{"prompt_token_count":2931,"prompt_tokens_details":[{"modality":"TEXT","token_count":2931}],"total_token_count":2931},"automatic_function_calling_history":[]}

To Reproduce
Steps to reproduce the behavior:
The error appears randomly during agent execution. Though there is no pattern to this, I've noticed this issue when you go out of sequence and ask questions to the root agent.

Expected behavior
I expect the agent to return a valid and complete response, or at least provide a clearer error message with function its trying to call and guidance on how to resolve the issue.

Screenshots

Image

Desktop (please complete the following information):

  • OS: Ubuntu 24.04.2 LTS
  • Python version(python -V): 3.13.3
  • ADK version(pip show google-adk): 1.1.1

Additional context
This issue kind of breaks the orchestration flow of the Root Agent.

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK botcore[Component] This issue is related to the core interface and implementationdocumentation[Component] This issue is related to documentation, it will be transferred to adk-docsneed attention[Status] This issue is important but the maintainers haven't started working on itwip[Status] This issue is being worked on. Either there is a pending PR or is planned to be fixed

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions