Skip to content

Gemini provider: function_response.name empty on session replay → 400 INVALID_ARGUMENT #46717

@Javacabra

Description

@Javacabra

Bug

When using a Gemini-backed agent (google-generative-ai provider, gemini-3.1-pro-preview), tool results are serialized into the session history with an empty name field in the function_response part. On session replay, the Google API rejects the request:

GenerateContentRequest.contents[2].parts[0].function_response.name: Name cannot be empty.

Reproduction

  1. Configure an agent with model: google/gemini-3.1-pro-preview
  2. Send a message that triggers a tool call (e.g. 'read file X')
  3. First response works fine
  4. Send any follow-up message → 400 error
  5. Inspect the session JSONL: the toolResult entry has toolName: undefined or missing entirely

Impact

  • Every Gemini agent with tools enabled becomes permanently broken after first tool call
  • Only fix is wiping the session file (we've done this 7+ times in 2 weeks)
  • Re-corrupts immediately on next tool use

Environment

  • OpenClaw 2026.3.13 (61d171a)
  • @google/genai SDK (bundled)
  • Model: gemini-3.1-pro-preview
  • macOS arm64

Expected

The function_response.name should be populated from the preceding functionCall in the conversation, matching the tool name that was called.

Workaround

Currently wiping session files, but corruption recurs on every tool call. Only real workaround is disabling tools for the agent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions