-
-
Notifications
You must be signed in to change notification settings - Fork 69.7k
Gemini API: function_response.name empty causes 400 INVALID_ARGUMENT #47857
Copy link
Copy link
Open
Description
Bug Description
When using google/gemini-2.5-flash or google/gemini-3-flash-preview as agent model, every request fails with:
GenerateContentRequest.contents[N].parts[0].function_response.name: Name cannot be empty.
Gemini API requires function_response.name to be non-empty, but Gateway's google-generative-ai adapter sends tool result messages with empty name field.
Reproduction
- Set agent model to
google/gemini-2.5-flashorgoogle/gemini-3-flash-preview - Send any message in a channel that has tool definitions (skills)
- Error occurs on every request, even after
/new
Error Details
From gateway log:
{
"error": {
"code": 400,
"message": "* GenerateContentRequest.contents[6].parts[0].function_response.name: Name cannot be empty.\n* GenerateContentRequest.contents[8].parts[0].function_response.name: Name cannot be empty.\n",
"status": "INVALID_ARGUMENT"
}
}- Positions
contents[6]andcontents[8]are consistent across requests (before/new) - After
/newwith LCM context injection, positions shift tocontents[98]andcontents[100] - Both
gemini-2.5-flashandgemini-3-flash-previewaffected - Other providers (anthropic, mm/MiniMax, moonshot) work fine with same session
Root Cause Hypothesis
Gateway converts internal OpenClaw message format to Gemini's GenerateContentRequest. Tool result messages (tool_result / function_response) need a name field matching the original function call. The converter appears to lose the function name during this translation.
Environment
- OpenClaw 2026.3.13
- API:
google-generative-ai(v1beta) - macOS Darwin 24.6.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.