claude-code - 💡(How to fix) Fix API Error 400: text content blocks must be non-empty - session becomes unresumable

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…

Error Message

After a conversation session ends with errors, attempting to resume or continue the session results in repeated API errors. Every message typed triggers the same error and the session cannot be recovered. Error message API Error: 400 messages: text content blocks must be non-empty 3. Every input returns the 400 error — the session is stuck Claude Code should either recover gracefully or start a fresh session, not get stuck in an unrecoverable error loop. The root cause appears to be that an empty text content block gets written into the session history. When the history is replayed to the API on the next message, the API rejects it with a 400 error every time. Workaround: start a completely fresh session.

Root Cause

Additional context The root cause appears to be that an empty text content block gets written into the session history. When the history is replayed to the API on the next message, the API rejects it with a 400 error every time. Workaround: start a completely fresh session.

Fix Action

Fix / Workaround

Additional context The root cause appears to be that an empty text content block gets written into the session history. When the history is replayed to the API on the next message, the API rejects it with a 400 error every time. Workaround: start a completely fresh session.

RAW_BUFFERClick to expand / collapse

Describe the bug After a conversation session ends with errors, attempting to resume or continue the session results in repeated API errors. Every message typed triggers the same error and the session cannot be recovered.

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

To reproduce

  1. Have a conversation session that ends with errors
  2. Try to resume or continue typing in that session
  3. Every input returns the 400 error — the session is stuck

Expected behavior Claude Code should either recover gracefully or start a fresh session, not get stuck in an unrecoverable error loop.

Environment

  • OS: Windows 10
  • Claude Code version: 2.1.144
  • Model: Claude Sonnet 4.6

Additional context The root cause appears to be that an empty text content block gets written into the session history. When the history is replayed to the API on the next message, the API rejects it with a 400 error every time. Workaround: start a completely fresh session.

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