[BUG] Submitting a screenshot with no text causes unrecoverable 400 error loop
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?
Pasting a screenshot into the Claude Code chat and pressing Enter without typing any accompanying text triggers a 400 error loop. Once it starts, every subsequent message fails and the session becomes unusable.
Two errors appear in rotation:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"messages.150.content.1.text: cache_control cannot be set for
empty text blocks"},"request_id":"req_011Cajx315Mf8Q3vybduyYCs"}
API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"messages: text content blocks must be non-empty"},
"request_id":"req_011CajxAvy2DYSUKYBEDLbdE"}
Root cause (as best I can tell)
When an image is submitted with no text, Claude Code appears to construct a message with an empty text block alongside the image block — {"type": "text", "text": ""}. The API rejects empty text blocks outright, and also rejects cache_control being set on them. Claude Code then retries rather than recovering, looping indefinitely.
To reproduce
Open any session
Paste a screenshot into the chat input
Press Enter without typing any text
Observe 400 errors begin and repeat indefinitely
This reproduced across two separate fresh sessions on the same day.
Expected behavior
Claude Code should either strip empty text blocks before sending, or treat a bare image submission as valid (no text block needed)
A client-side 400 (malformed payload) should not trigger retries — it should surface a clear error and stop
Environment
Platform: Claude Code web (claude.ai/code)
Request IDs: req_011Cajx315Mf8Q3vybduyYCs, req_011CajxAvy2DYSUKYBEDLbdE, req_011CajxCi3hepG2D3xAFkeDU, req_011CajxH8RWa2jZBWRAqhvZk
What Should Happen?
it should look at the screenshot and consider it in the context of surrounding chats
Error Messages/Logs
API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"messages.150.content.1.text: cache_control cannot be set for
empty text blocks"},"request_id":"req_011Cajx315Mf8Q3vybduyYCs"}
API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"messages: text content blocks must be non-empty"},
"request_id":"req_011CajxAvy2DYSUKYBEDLbdE"}
Steps to Reproduce
paste an image without any text
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
web version, i dont know where to find the version, and it's stuck in 400 errors
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗