claude-code - 💡(How to fix) Fix [BUG] API Error: 400 messages: text content blocks must be non-empty [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#56443Fetched 2026-05-06 06:27:54
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×5commented ×1renamed ×1

Error Message

API Error: 400 messages: text content blocks must be non-empty

Code Example

API Error: 400 messages: text content blocks must be non-empty
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?

<img width="1292" height="917" alt="Image" src="https://github.com/user-attachments/assets/8a32628d-87df-4971-8476-2c7a99d6efc5" />

2.1.143 (Claude Code)

What Should Happen?

should reply

Error Messages/Logs

API Error: 400 messages: text content blocks must be non-empty

Steps to Reproduce

it's not taking any input

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.143

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

No response

extent analysis

TL;DR

Check and ensure that all text content blocks in the request have non-empty text to resolve the API Error 400.

Guidance

  • Review the request payload to identify any empty text blocks and remove or populate them with relevant text.
  • Verify that the cache_control setting is not being applied to empty text blocks, as this is explicitly disallowed.
  • Test the request with a minimal payload containing only non-empty text blocks to isolate the issue.
  • If the issue persists, try resetting the request payload to its default state or seeking assistance from the API support team.

Example

No code snippet is provided as the issue is related to the request payload and API interaction, which is not explicitly shown in the issue body.

Notes

The issue seems to be related to a regression in the Claude Code version v2.0.73+, and the exact cause may require further investigation or support from the API team.

Recommendation

Apply workaround: Ensure all text content blocks have non-empty text, as this is the most direct way to address the API Error 400 messages provided.

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] API Error: 400 messages: text content blocks must be non-empty [1 comments, 2 participants]