[BUG] Claude Code Cloud: API 400 "cache_control cannot be set for empty text blocks" bricks sessions unrecoverably
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 Cloud sessions are crashing with a 400 from the Anthropic
Messages API and become permanently unusable once they do. The agent
is constructing request payloads that contain a text content block with
empty text and a cache_control marker attached to it, which the API
correctly rejects.
<img width="1352" height="287" alt="Image" src="https://github.com/user-attachments/assets/8ab1ac23-1064-405c-b4d0-5c2d012e5911" />
<img width="1302" height="713" alt="Image" src="https://github.com/user-attachments/assets/f8ec8db2-13f8-401b-ae9e-5e7033753e03" />
What Should Happen?
Claude should work and continue coding...
Error Messages/Logs
API Error: 400 messages.248.content.3.text: cache_control cannot be set for empty text blocks
API Error: 400 messages.28.content.2.text: cache_control cannot be set for empty text blocks
API Error: 400 messages: text content blocks must be non-empty
Steps to Reproduce
I don't know how to reproduce, happend in two different sessions, one long (>200 messages) and one brand new (~25 messages). I think it happend when i pasted a screenshot.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude 1.7196.0 (2dbd78) 2026-05-12T05:34:40.000Z
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗