[BUG] API Error 400: "first block must be thinking" after tool use with extended thinking enabled

Status Fixed / completed
Reported on v2.1.19
Maintainer reply None cached
Activity 3 comments · opened Jan 25, 2026 · closed Jan 25, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code crashes with an API 400 error after completing tool use when extended thinking is enabled. The error occurs when the assistant tries to continue the conversation after an exploration/tool use step completes.

What Should Happen?

Claude Code should properly structure messages with thinking blocks in the correct order when sending requests to the API after tool use.

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.0: If an assistant message contains any thinking blocks, the first block must be `thinking` or `redacted_thinking`. Found `text`."},"request_id":"req_011CXTAZk5VnpzTgBPHBuoWu"}

Steps to Reproduce

  1. Launch Claude Code with Claude Max subscription (Opus 4.5 with extended thinking)
  2. Enter a prompt that triggers tool use (e.g., "fix typecheck errors" or exploring a codebase)
  3. Wait for tool use to complete
  4. Error occurs when Claude Code attempts to send the follow-up message

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.19

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

  • Error persists after fresh installation via native installer
  • Error persists after clearing conversation cache
  • The issue appears to be in how Claude Code constructs the message payload when combining tool results with extended thinking blocks

Workaround Attempted

  • Reinstalled via native installer
  • Cleared ~/.claude/projects/*/conversation.json
  • Issue persists

View original on GitHub ↗

3 Comments

pax-k · 8 months ago

Same for me, i'm using the latest version for claude and the vscode extension. Started seeing this 40 minutes ago and it's consistent for any new session.

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/20692
  2. https://github.com/anthropics/claude-code/issues/20691
  3. https://github.com/anthropics/claude-code/issues/20689

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] · 8 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.