Skip to content

gemini_cli - Gemini 2.5 flash bad request 400 - missing thought_signature #160

@dehidehidehi

Description

@dehidehidehi

Branch

main

Branch (if other)

No response

Version / Tag / Commit

main/build-20260527-1-af40b91

Provider(s) Affected

gemini_cli

Deployment Method

Docker

Operating System

Ubuntu 22.04

Python Version (if running from source)

No response

Bug Description

Hello,
It would seem the API for gemini 2.5 flash-lite has changed and those requests are now returning errors.

From the stdout logs:

Released credential env:...li/4 from gemini_cli/gemini-2.5-flash-lite (remaining concurrent: 0/2)
Acquiring credential for model gemini_cli/gemini-2.5-flash-lite. Tried: 3/4(4)
Acquired key ..._cli/3 for model gemini_cli/gemini-2.5-flash-lite (tier: None, priority: 999, selection: sequential, quota: 15/1500 [99%])
Attempting stream with credential ..._cli/3 (Attempt 1/2)
Stream connection established for credential ..._cli/3. Processing response.
Gemini CLI API error 400: {
  "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:glob` , position 2. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.",
    "status": "INVALID_ARGUMENT"
  }
}

API call failed for model gemini_cli/gemini-2.5-flash-lite with key ..._cli/3. Error: HTTPStatusError. See failures.log for details.
Released credential env:...li/3 from gemini_cli/gemini-2.5-flash-lite (remaining concurrent: 0/2)
All 4 credentials tried for gemini_cli/gemini-2.5-flash-lite

Error from failures.log:

{"timestamp": "2026-05-29T09:05:47.534723", "api_key_ending": "..._cli/3", "model": "gemini_cli/gemini-2.5-flash-lite", "attempt_number": 1, "error_type": "HTTPStatusError", "error_message": "Client error '400 Bad Request' for url 'https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:streamGenerateContent?alt=sse'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400", "raw_response": "{\n  \"error\": {\n    \"code\": 400,\n    \"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:glob` , position 2. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.\",\n    \"status\": \"INVALID_ARGUMENT\"\n  }\n}\n", "request_headers": {"authorization": "Bearer 12345", "content-type": "application/json", "user-agent": "opencode/1.4.3 ai-sdk/provider-utils/4.0.21 runtime/bun/1.3.11", "x-parent-session-id": "ses_18d190127ffejVDfcFFpaY1xZv", "x-session-affinity": "ses_18d04a15affekVWnxS51rvVHaW", "connection": "keep-alive", "accept": "*/*", "host": "host.docker.internal:8000", "accept-encoding": "gzip, deflate, br, zstd", "content-length": "87541"}, "error_chain": null}                                                                                                                                               ~

Steps to Reproduce

You may setup this model with this ENV VAR:

GEMINI_CLI_MODELS='{
  "gemini-2.5-flash-lite": {
    "id": "gemini-2.5-flash-lite",
    "limit": { "context": 280000, "output": 64000 },
    "modalities": { "input": [ "image", "text", "video", "audio", "pdf" ], "output": [ "text" ] },
    "options": { "thinking_budget": 0 }
  }'

Expected Behavior

No error

Actual Behavior

Logs the error as showed in description.

Error Logs / Messages


Pre-submission Checklist

  • I have searched existing issues to ensure this is not a duplicate

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions