API Error 400: "user messages must have non-empty content" breaks long conversations
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?
During a long conversation (~332+ messages), I started getting a persistent API Error 400 that made the conversation completely unrecoverable. Every subsequent message returned the same error.
What Should Happen?
Long conversations should not break. If a message slot becomes empty due to context compression or other internal processing, the API should handle it gracefully rather than returning an unrecoverable error.
Error Messages/Logs
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.332: user messages must have non-empty content"},"request_id":"req_011CZPSH4nwewodHGx9vezpn"}
Steps to Reproduce
Have a long conversation with 300+ messages
At some point the conversation breaks with this error
Every new message after that returns the same error
No way to recover — must start a new conversation
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.81
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗