[BUG] API Error 400: cache_control cannot be set for empty text blocks

Resolved 💬 3 comments Opened Apr 22, 2026 by ChrisBahi Closed Apr 26, 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 throws a 400 API error mid-conversation and fails the turn. Happens repeatedly in long sessions.

What Should Happen?

Conversation continues normally without errors.

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.306.content.2.text: cache_control cannot be set for empty text blocks"},"request_id":"req_011CaKAoZGt1W7zbyMEA3a3E"}

Steps to Reproduce

  1. Start a long multi-turn conversation in Claude Code web
  2. After many messages (~100+), the turn fails with the error above
  3. Retrying usually works

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

claude-sonnet-4-6

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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