VS Code extension: API 400 error - Invalid signature in thinking block when using Sonnet/Opus
Description
When using Claude Code in the VS Code extension with Sonnet or Opus models, the API returns a 400 error related to thinking block signature validation. The same model and conversation work correctly in the Claude Code terminal CLI.
Error Message
API Error: 400 {"error":{"code":"400","type":"invalid_params","message":"messages.1.content.0: Invalid signature in thinking block"}}
Steps to Reproduce
- Open Claude Code in VS Code (extension)
- Select Sonnet or Opus model
- Send a message and start a conversation
- On subsequent turns, the error appears
Expected Behavior
The conversation should continue normally, as it does in the terminal CLI.
Actual Behavior
The VS Code extension returns 400 Invalid signature in thinking block, making the conversation unusable.
Root Cause (suspected)
When Claude uses Extended Thinking, the response contains thinking blocks with cryptographic signatures. These signatures must be preserved intact and passed back in subsequent API requests. It appears the VS Code extension is not correctly preserving these signatures when serializing/deserializing conversation history between turns, while the terminal CLI handles this correctly.
Note: messages.1.content.0 in the error points to the very first assistant message in the history, suggesting the thinking block signature is corrupted or stripped immediately after the first response.
Environment
| | |
|---|---|
| OS | macOS 26.4.1 (Build 25E253) |
| VS Code | 1.117.0 |
| Claude Code VS Code Extension | 2.1.119 |
| Claude Code CLI | 2.1.109 |
Workaround
Using Claude Code via terminal CLI works correctly. The issue is isolated to the VS Code extension.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗