claude-code - 💡(How to fix) Fix [BUG] aAPI Error API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages: text content blocks must be non-empty"},"request_id":"req_011CadzdJN5EMs3LtT7nCK6X"} [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55606Fetched 2026-05-03 04:49:06
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

Error Message

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

Code Example

API Error
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.716.content.1.text: cache_control cannot be set for empty text blocks"},"request_id":"req_011CadzcQ9Z32r4LqUME6L7Z"}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

when i paste a screenshot into chat it crashes teh session in claude code. its impossible to always remember to add a charachter into the chat to prevent this error.

<img width="923" height="723" alt="Image" src="https://github.com/user-attachments/assets/5d228238-da5e-43f7-8427-c676438fe85d" />

What Should Happen?

it should just let the screenshot go through

Error Messages/Logs

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

Steps to Reproduce

paste a screenshot into chat with no text

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

Claude Code 2.1.126.

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

No response

extent analysis

TL;DR

Adding a character to the chat before pasting a screenshot may prevent the session from crashing in Claude Code.

Guidance

  • Verify that the issue is specific to pasting screenshots without any accompanying text by testing with different types of content.
  • Check if the error message messages.716.content.1.text: cache_control cannot be set for empty text blocks provides any clues about the required format for text blocks.
  • Test if adding a character before pasting the screenshot consistently resolves the issue.
  • Consider reporting this as a regression bug since it worked in a previous version.

Example

No code snippet is provided as the issue seems related to the interaction with the Claude Code interface rather than a code-based solution.

Notes

The provided error message suggests that there might be a specific requirement for text blocks that is not being met when only a screenshot is pasted. The fact that adding a character prevents the crash implies that the issue is related to empty text blocks.

Recommendation

Apply workaround: Add a character to the chat before pasting a screenshot, as this has been reported to prevent the session from crashing. This is chosen because it provides an immediate, albeit temporary, solution to the problem while a more permanent fix is developed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] aAPI Error API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages: text content blocks must be non-empty"},"request_id":"req_011CadzdJN5EMs3LtT7nCK6X"} [1 comments, 2 participants]