openclaw - 💡(How to fix) Fix Gemini 3 Flash tool calls fail with 400: missing thought_signature in OpenAI-compatible mode [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77925Fetched 2026-05-06 06:19:20
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Author
Timeline (top)
closed ×1commented ×1mentioned ×1subscribed ×1

Error Message

HTTP 400: [{
  "error": {
    "code": 400,
    "message": "Unable to submit request because function call `exec` in the 2. content block is missing a `thought_signature`. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures",
    "status": "INVALID_ARGUMENT"
  }
}]

Root Cause

Gemini 3 Flash returns a thought_signature field inside extra_content.google on every assistant message and tool call when thinking/reasoning is active. The Google Vertex AI OpenAI-compatible API requires this thought_signature to be passed back unchanged in subsequent requests.

OpenClaw's OpenAI-compatible layer currently discards the extra_content.google.thought_signature field when processing tool results, causing the next API call to fail.

Code Example

HTTP 400: [{
  "error": {
    "code": 400,
    "message": "Unable to submit request because function call `exec` in the 2. content block is missing a `thought_signature`. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures",
    "status": "INVALID_ARGUMENT"
  }
}]

---

{
     "baseUrl": "http://127.0.0.1:8790/v1/projects/PROJECT/locations/global/endpoints/openapi",
     "api": "openai-completions",
     "models": [{ "id": "gemini-3-flash-preview" }]
   }

---

{
  "choices": [{
    "message": {
      "tool_calls": [{
        "extra_content": {
          "google": {
            "thought_signature": "AY89a19pcPpW8fF2gPU7VtN98DGJ4f7dt4n1AV..."
          }
        },
        "function": {
          "arguments": "{\"city\":\"Beijing\"}",
          "name": "get_weather"
        },
        "id": "function-call-269de851-08e8-4b36-bb0f-1218599cb0d0",
        "type": "function"
      }]
    }
  }]
}
RAW_BUFFERClick to expand / collapse

Bug Description

When using Gemini 3 Flash (via Google Vertex AI OpenAI-compatible endpoint) as a subagent model, tool calls fail with HTTP 400 after the first successful tool invocation. The error occurs when OpenClaw sends the tool result back to the model.

Error Message

HTTP 400: [{
  "error": {
    "code": 400,
    "message": "Unable to submit request because function call `exec` in the 2. content block is missing a `thought_signature`. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures",
    "status": "INVALID_ARGUMENT"
  }
}]

Root Cause

Gemini 3 Flash returns a thought_signature field inside extra_content.google on every assistant message and tool call when thinking/reasoning is active. The Google Vertex AI OpenAI-compatible API requires this thought_signature to be passed back unchanged in subsequent requests.

OpenClaw's OpenAI-compatible layer currently discards the extra_content.google.thought_signature field when processing tool results, causing the next API call to fail.

Reproduction Steps

  1. Configure google-custom provider pointing to Vertex AI OpenAI-compatible endpoint:
    {
      "baseUrl": "http://127.0.0.1:8790/v1/projects/PROJECT/locations/global/endpoints/openapi",
      "api": "openai-completions",
      "models": [{ "id": "gemini-3-flash-preview" }]
    }
  2. Spawn a subagent with model: "google-custom/gemini-3-flash-preview"
  3. The subagent successfully makes a tool call (e.g., exec)
  4. When OpenClaw sends the tool result back, Gemini returns 400

Verified Behavior

  • Simple tool call (single turn): Works fine — Gemini correctly returns tool_calls with valid function.name and function.arguments
  • Tool result roundtrip: Fails — the thought_signature from the previous assistant message is lost
  • Plain chat (no tools): Works fine

API Response Example (showing thought_signature)

{
  "choices": [{
    "message": {
      "tool_calls": [{
        "extra_content": {
          "google": {
            "thought_signature": "AY89a19pcPpW8fF2gPU7VtN98DGJ4f7dt4n1AV..."
          }
        },
        "function": {
          "arguments": "{\"city\":\"Beijing\"}",
          "name": "get_weather"
        },
        "id": "function-call-269de851-08e8-4b36-bb0f-1218599cb0d0",
        "type": "function"
      }]
    }
  }]
}

Suggested Fix

OpenClaw should preserve and replay the extra_content.google.thought_signature field when constructing follow-up messages for Gemini models via the OpenAI-compatible endpoint. This is required by the Vertex AI API specification for models with thinking enabled.

Reference: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures

Environment

  • OpenClaw: 2026.5.3-1
  • Model: google-custom/gemini-3-flash-preview (Vertex AI OpenAI-compatible)
  • OS: macOS 26.4.1 (arm64)
  • Node: v22.22.0

extent analysis

TL;DR

Preserve and replay the extra_content.google.thought_signature field in follow-up messages to fix the HTTP 400 error.

Guidance

  • Verify that the thought_signature field is being discarded by OpenClaw when processing tool results by checking the API requests sent to the Vertex AI OpenAI-compatible endpoint.
  • Modify OpenClaw's OpenAI-compatible layer to preserve the extra_content.google.thought_signature field from the previous assistant message and include it in subsequent requests.
  • Test the fix by reproducing the error and verifying that the thought_signature field is being passed back unchanged in subsequent requests.
  • Review the Vertex AI API documentation to ensure compliance with the thought signature requirements for models with thinking enabled.

Example

No code snippet is provided as the issue is related to the OpenClaw implementation, and the fix requires modifying the OpenClaw codebase to preserve the thought_signature field.

Notes

The fix assumes that the OpenClaw implementation can be modified to preserve the thought_signature field. If this is not possible, alternative workarounds may be necessary.

Recommendation

Apply the workaround by preserving and replaying the extra_content.google.thought_signature field in follow-up messages, as this is a requirement for the Vertex AI API specification for models with thinking enabled.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Gemini 3 Flash tool calls fail with 400: missing thought_signature in OpenAI-compatible mode [1 comments, 2 participants]