mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
agent strategy function call error with gemini flash model #314
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @muzhi1991 on GitHub (May 27, 2025).
Originally assigned to: @laipz8200 on GitHub.
Self Checks
Dify version
latest
Cloud or Self Hosted
Cloud
Steps to reproduce
Configuration: An agent node, use the built-in Agent policy, select functioncall, and select the 2.5 flash 0520 version of gemini (I have no limit to test other models). The tool choose time/current time
Test: Preview Chat Enter: Current time.
✔️ Expected Behavior
Normal call tool
❌ Actual Behavior
output error:
Run failed: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: [google] Error: PluginInvokeError: {"args":{"description":"function_call_id received is not a string"},"error_type":"InvokeError","message":"function_call_id received is not a string"}"}
@dosubot[bot] commented on GitHub (May 27, 2025):
Hi @muzhi1991! I'm Dosu and I’m helping the dify team.
The error
function_call_id received is not a stringduring an agent strategy function call with the Gemini Flash model appears to be caused by a type mismatch—where the system expectsfunction_call_idto be a string, but it receives a different type. This typically happens during the parsing and handling of tool calls in the agent workflow.Here are some key findings that may help resolve or diagnose the issue:
The agent function call logic in Dify expects tool call information (including
tool_call_id) to be properly formatted and typed. If the LLM (in this case, Gemini 2.5 Flash 0520) returns a tool call with an ID that is not a string, this error will occur. The relevant logic is in theFunctionCallAgentRunnerclass, which parses tool call arguments and IDs from the LLM response. If the arguments or IDs are not as expected, it can trigger this error. See the implementation details here.The Gemini 1.5 Flash model is configured to support tool-calling features, so in principle, it should be compatible with function calling workflows. However, if the model's output format changes or is inconsistent, it could cause type mismatches like this one. See model capabilities here.
The
current_timetool itself is implemented to accept parameters and return the current time, and is not likely the direct cause of the type error unless the tool call arguments are malformed upstream. See the tool implementation here.There is a known issue where some models do not support function calling properly, leading to instability with tools like
current_time. If the Gemini model's function calling output is not fully compatible with Dify's expectations, this could be the root cause. A similar issue was reported with another model, where switching to a model with robust function calling support resolved the problem. See the related issue here.A previous, similar issue with agent nodes and function calling was resolved by a pull request. Reviewing the changes in that PR may provide further insight: Issue langgenius/dify#15118.
Potential solutions and next steps:
function_call_id).If you need more detailed troubleshooting, providing a sample of the raw LLM response that triggers the error could help pinpoint the exact mismatch.
To reply, just mention my name @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@laipz8200 commented on GitHub (May 28, 2025):
Gemini 1.5 Pro is the same.