Calling 2 tools with Google Generative AI Components returns 400
Bug Description
Hi,
I found the following behaviour when chatting with the Google Generative AI component (GGAI), ie Gemini:
With a simple flow, an agent and a tool, asking it to use the tool twice creates a 400 error code which traces to langchain_google_genai.chat_models.ChatGoogleGenerativeAIError: Invalid argument provided to Gemini: 400 * GenerateContentRequest.contents[14].parts[0].function_response.name: Name cannot be empty., recreation is quite easy.
Reproduction
Steps to reproduce this behaviour :
- Create a new Simple Agent flow
- Use the GGAI component and link it to 'custom' language model. (dont forget to choose a model, here I use 2.0-flash but the behaviour is the same with 1.5 pro etc.)
- Keep the calculator as a too and make sure inputs/outputs are ok
- Asking : "Can you compute what 24+9 and 1920/1.28" results in the error.
- Testing with another model provider (here I used Mistral) yields the right answer "The result of 24+9 is 33 and the result of 1920/1.28 is 1500. ".
Expected behavior
The error messages is as follows :
An error occured in the Agent Component, stopping your flow. See below for more details.
Error details:
ChatGoogleGenerativeAIError
**Details: Invalid argument provided to Gemini: 400 * GenerateContentRequest.contents[4].parts[0].function_response.name: Name cannot be empty. **
Who can help?
No response
Operating System
Ubuntu 24.04.2 LTS
Langflow Version
langflowai/langflow:1.4.2
Python Version
3.12
Screenshot
GGAI :
Mistral:
Langsmith trace: (EDIT)
Flow File
Based on your description and the available information, the 400 error (function_response.name: Name cannot be empty) when using the Google Generative AI (Gemini) component in Langflow appears to be related to how tool calls are handled when the agent is asked to use a tool multiple times in a single prompt.
Key Findings
- The error message indicates that a required field (
function_response.name) in the request to Gemini is empty, which is likely causing the 400 error from the API. - This issue is specific to the Google Generative AI component and does not occur with other providers like Mistral, suggesting a difference in how tool calls are structured or serialized for Gemini.
- The
GoogleGenerativeAIComponentin Langflow is responsible for generating text using Gemini and includes atool_model_enabledinput, which controls whether the tool model is used. Misconfiguration or a bug in how multiple tool calls are handled could result in missing or empty fields in the request payload, especially when the agent is asked to use a tool more than once in a single prompt [source]. - There are no existing issues or discussions in the Langflow repository that specifically address this error or provide a direct fix.
What You Can Try
- Check the
tool_model_enabledSetting: Ensure that this is set appropriately for your use case. If you are using tools, this should typically be enabled. If it is disabled, the model may not handle tool calls correctly. - Review the Flow Configuration: Double-check that all required fields for the tool and agent are set and that the tool names are not empty or missing in your flow file.
- Workaround: If possible, try splitting your prompt into separate requests (one tool call per prompt) as a temporary workaround until the underlying issue is resolved.
- Recent Changes: The
GoogleGenerativeAIComponentwas recently updated (as of 2025-05-20), so if this issue started after an update, it may be related to recent changes in how tool calls are handled [source].
Limitations
- Without access to the exact flow file and the ability to inspect the serialized request payload, it's not possible to pinpoint the exact misconfiguration or bug.
- There is no official documentation or support thread that directly addresses this specific error with Gemini in Langflow.
If you continue to encounter this issue, consider isolating the problem by testing with different tool configurations or prompts, and monitor for updates to the Langflow or langchain_google_genai packages that may address this bug.
To continue talking to Dosu, mention @dosu-bot.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
Adding comment for visibility. Same issue here and that bot's answer is useless.
@dosu Could you please tag a member of langflow in this. Langflow relies on OpenAI style tool calling which is lenient with how tool responses are set. While Gemini is strict with it. The tool calling agent need to make sure that a unique function response name is sent to gemini.
got same problems
Also experiencing this bug - any news?
Same problem here. Any news?
It renders Gemini + tools, unusable. Anyone from the team can pick it up plz?
does this still happen with 1.5.0post1?
does this still happen with 1.5.0post1?
Yes. Nonstop. Either with one or multiple tools.
Hey all, PR open here: https://github.com/langflow-ai/langflow/pull/10214
Same issue
Hello, the issue is currently occurring in the latest version 1.7.2, but not in the main branch. Since it was fixed in main, I'm closing this issue.
If I missed anything, please comment here and I'll reopen. Thanks for the report.