Skip to content

Function call is missing a thought_signature - Gemini

Quick fix

Upgrade or patch the cc-switch forwarder/session logic so Codex tool call requests carry a thought_signature.

Error output
CC Switch local proxy failed while handling Codex endpoint /responses. Provider: Google; model: models/gemini-3.1-flash-lite; upstream_status: HTTP 400; cause: [{"error":{"code":400,"message":"Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call `default_api:mcp__node_repl__js` , position 37. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.","status":"INVALID_ARGUMENT"}}]

At its core, the Gemini API added a new requirement on the functionCall data structure: a thought_signature field must be present whenever a tool call is involved. Users across several issues see the same class of HTTP 400 INVALID_ARGUMENT, differing only in model name, function call name, and position. When Codex reaches Gemini, for instance, any tool call means the request the cc-switch local proxy forwards to Gemini lacks a thought_signature and is rejected upstream.

Some related errors fall under the same invalid_argument umbrella with a different mechanism: #2206 is an early version leaking Claude's prompt_cache_key into Google AI Studio / Gemini requests, producing an Unknown name "prompt_cache_key" 400, which a maintainer confirmed fixed in v3.14.0. #1786 is tool_calls[0] id cannot be empty when relaying Claude Code through New API, also invalid_argument but not the same root cause as thought_signature. This page covers the tool call failures caused by the missing Gemini thought_signature.

  1. If you are on a version before v3.14.0, upgrade cc-switch first so prompt_cache_key does not leak into Google AI Studio / Gemini requests.

  2. For the Gemini thought_signature problem, upgrade to a cc-switch version containing the fix; users in the issue confirm it works on v3.20 after the session and forwarder logic was updated.

  3. If you cannot upgrade yet, follow the patch approach a user shared in the issue and modify the cc-switch proxy forwarding logic so Codex /responses tool calls carry a thought_signature when forwarded to the Gemini API.

    cc-switch\src-tauri\src\proxy\forwarder.rs
    # 按 issue #5415 中用户提供的 v3.20 补丁思路更新 forwarder/session 逻辑
  4. Trigger a tool call in Codex again and confirm the HTTP 400 Function call is missing a thought_signature no longer appears.

ToolCodex
Version3.13.0 - 3.16.3
PlatformsWindowsmacOS
Is this a Google API problem or a cc-switch problem?
From the issues, the direct cause is cc-switch not carrying the thought_signature field Gemini now requires when forwarding Codex tool calls, so upstream returns HTTP 400.
Why does it work when no tool is called?
Several issues note that without a tool call the request involves no functionCall, so no thought_signature can be missing. The error appears as soon as Codex calls a tool.
Is the prompt_cache_key error the same problem as thought_signature?
Not the same root cause, though both are invalid_argument errors. prompt_cache_key was an early version leaking a Claude field to the Google API, which maintainers say was fixed in v3.14.0; thought_signature is a new Gemini tool call field that has not been adapted to.
Which version do the issues suggest might work?
A user in issue #5415 says it works after modifying the session and forwarder files on v3.20, but nothing in the input has a maintainer confirming that as an official fix release.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.