Skip to content

[Bug]: Gemini 3.1 Pro Preview via OpenAI-compatible API missing thought_signature in tool_calls #58235

@pijianqiang

Description

@pijianqiang

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When using OpenClaw's custom OpenAI protocol service provider to interface with Google Gemini 3.1 Pro Preview, the returned tool_calls are missing the extra_content.google.thought_signature field, causing the Gemini API to return a 400 error.

Steps to reproduce

Add a custom model service provider in OpenClaw, selecting OpenAI compatible protocol.

Model name: gemini-3.1-pro-preview
Create a dialogue and send a message that triggers a tool call/function call (e.g., instructing the model to query information or use a tool).

An error occurs immediately after sending:
plaintext
400 Bad Request
Missing required field: thought_signature
Packet capture reveals the returned structure: the extra_content.google.thought_signature field is missing from tool_calls.

Image

Expected behavior

The returned tool call must include:

json
"extra_content": {

"google": {

"thought_signature": "signature"

}
}

Actual behavior

Image

When using OpenClaw to customize an OpenAI-compatible service provider, calling the gemini-3.1-pro-preview model and triggering a tool call:

User-visible result: The interface directly returns a 400 Bad Request error, with the error message "Missing required field 'thought_signature' in tool call." There is no normal model response.

Gateway log evidence: OpenClaw gateway logs show that the tool call object within the assistant.message.tool_calls array in the constructed OpenAI protocol request is completely missing the extra_content.google.thought_signature field.

Functionality: The tool call/function call functionality of the Gemini 3.1 model is completely disabled, unable to complete any tasks that depend on the tool.

OpenClaw version

2026.3.28

Operating system

Windows11

Install method

npm全局

Model

gemini-3.1-pro-preview

Provider / routing chain

openclaw -> self-proxy -> google-gemini

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Mar 31 15:41:35 szdn-2024MSZVUU node[1866]:   'data: 400 ## Bad Request ## data: [{',
Mar 31 15:41:35 szdn-2024MSZVUU node[1866]:   '  "error": {',
Mar 31 15:41:35 szdn-2024MSZVUU node[1866]:   '    "code": 400,',
Mar 31 15:41:35 szdn-2024MSZVUU node[1866]:   '    "message": "Unable to submit request because function call `default_api:read` in the 2. content block is missing a `thought_signature`. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures",',
Mar 31 15:41:35 szdn-2024MSZVUU node[1866]:   '    "status": "INVALID_ARGUMENT"',
Mar 31 15:41:35 szdn-2024MSZVUU node[1866]:   '  }',
Mar 31 15:41:35 szdn-2024MSZVUU node[1866]:   '}',
Mar 31 15:41:35 szdn-2024MSZVUU node[1866]:   ']'
Mar 31 15:41:35 szdn-2024MSZVUU node[1866]: ]
Mar 31 15:41:35 szdn-2024MSZVUU node[1866]: 2026-03-31T15:41:35.612+08:00 [agent/embedded] embedded run agent end: runId=2deca8ea-f9a7-4765-9943-d0132c66fa0d isError=true model=gemini-3.1-pro-preview provider=custom-api-aig-ai-com-openai error=Unexpected non-whitespace character after JSON at position 4 (line 1 column 5) rawError=Unexpected non-whitespace character after JSON at position 4 (line 1 column 5)

Impact and severity

Affected: All users who connect to Gemini 3.1 Pro Preview through OpenClaw's customized OpenAI compatible service providers, and the OpenClaw gateway service.
Severity: High (Blocks core workflows; tool call functionality is completely disabled)
Frequency: Always (99% reproducible; all requests triggering tool_calls result in errors)
Consequences: 1. AI Agents and automated tasks relying on Gemini 3.1 tools will completely fail to run; 2. User requests will directly fail, reducing service availability.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    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