Skip to content

Claude thinking model fails with 400 INVALID_ARGUMENT when session history contains signed thinking blocks #368

@Inrstning

Description

@Inrstning

Pre-submission checklist

Model used

antigravity-claude-opus-4-5-thinking

Exact error message

Request contains an invalid argument.
[Debug Info]
Requested Model: claude-opus-4-5-thinking
Effective Model: claude-opus-4-5-thinking
Project: extreme-elf-b6v41
Endpoint: https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:streamGenerateContent?alt=sse
Status: 400
Followed by:
Failed to process error response

Bug description

When using claude-opus-4-5-thinking or claude-sonnet-4-5-thinking models through Antigravity, subsequent requests in an existing session fail with 400 INVALID_ARGUMENT. New sessions work fine, but any session with prior thinking block responses cannot continue.

  • opencode version: (run opencode --version)
  • antigravity plugin: opencode-antigravity-auth@beta (v1.15.8)
  • OS: macOS
  1. Start a new session with claude-opus-4-5-thinking model
  2. Send any message → receives successful response with thinking blocks
  3. Send another message in the same session → 400 error
  4. OR: Try to run /compact on the session → 400 error
  • Models affected: claude-opus-4-5-thinking, claude-sonnet-4-5-thinking

Steps to reproduce

  1. Start a new session with claude-opus-4-5-thinking model
  2. Send many message → receives successful response with thinking blocks
  3. Send another message in the same session → 400 error
  4. OR: Try to run /compact on the session → 400 error

Did this ever work?

Worked before, now broken (regression)

Number of Google accounts configured

1

Reproducibility

Always (100%)

Plugin version

opencode-antigravity-auth@beta (v1.15.8)

OpenCode version

opencode --version 1.1.50

Operating System

MACOS 26.2 (25C56)

Node.js version

node --version v22.14.0

Environment type

Standard (native terminal)

MCP servers installed

No response

Debug logs (REQUIRED)

Root Cause Analysis
The session history sent to the API contains signed thinking blocks in this format:
{
  role: model,
  parts: [
    {
      thought: true,
      text: 用户在问...,
      thoughtSignature: RXFRRENrZ0lDeEFDR0FJcVFCcEZXWkNFU0k4Yi...
    },
    {
      functionCall: {...}
    }
  ]
}
When this history is sent back to the API (either for continuation or compact), the backend rejects it with INVALID_ARGUMENT.
Key observation: The same session works for the first message (no history) but fails on all subsequent messages (history includes signed thinking blocks).
Debug Log Evidence
From ~/.config/opencode/antigravity-logs/antigravity-debug-*.log:
[10:48:47.750Z] Response 400 Bad Request (6869ms)
[10:48:47.750Z] Response Body (400): {
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}
[10:48:47.753Z] Note: Failed to transform Antigravity response
[10:48:47.755Z] Error: Error: THINKING_RECOVERY_NEEDED
    at transformAntigravityResponse (request.js:1235:47)

Configuration (optional)

Compliance

  • I'm using this plugin for personal development only
  • This issue is not related to commercial use or TOS violations

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/modelsModel access, Claude/Gemini specificbugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions