claude-code - 💡(How to fix) Fix VS Code extension: API 400 error - Invalid signature in thinking block when using Sonnet/Opus [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52670Fetched 2026-04-24 10:42:54
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×4cross-referenced ×1

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"}}

Root Cause

Root Cause (suspected)

Fix Action

Workaround

Using Claude Code via terminal CLI works correctly. The issue is isolated to the VS Code extension.

Code Example

API Error: 400 {"error":{"code":"400","type":"invalid_params","message":"messages.1.content.0: Invalid signature in thinking block"}}
RAW_BUFFERClick to expand / collapse

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

  1. Open Claude Code in VS Code (extension)
  2. Select Sonnet or Opus model
  3. Send a message and start a conversation
  4. 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

OSmacOS 26.4.1 (Build 25E253)
VS Code1.117.0
Claude Code VS Code Extension2.1.119
Claude Code CLI2.1.109

Workaround

Using Claude Code via terminal CLI works correctly. The issue is isolated to the VS Code extension.

extent analysis

TL;DR

The VS Code extension likely needs to preserve the cryptographic signatures in thinking blocks when serializing/deserializing conversation history to fix the 400 error.

Guidance

  • Verify that the VS Code extension is correctly handling the serialization and deserialization of conversation history, particularly the preservation of thinking block signatures.
  • Check the extension's code for any differences in how it handles conversation history compared to the terminal CLI.
  • Investigate the messages.1.content.0 error message to determine why the signature is being corrupted or stripped after the first response.
  • Consider adding logging or debugging statements to the extension to track how the conversation history is being modified between turns.

Example

No code snippet is provided as the issue does not include specific code details.

Notes

The issue appears to be isolated to the VS Code extension, and using the terminal CLI works correctly. The root cause is suspected to be related to the preservation of thinking block signatures, but further investigation is needed to confirm.

Recommendation

Apply a workaround by using the Claude Code terminal CLI until the VS Code extension issue is resolved, as it is currently the only reliable way to avoid the 400 error.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING