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

Resolved 💬 3 comments Opened Jan 25, 2026 by ninjaplans 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 ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗