Bug: `--remote-control` mode causes 400 error when message contains image (cache_control on empty text block)
Summary
In --remote-control mode, sending a message that contains an image consistently triggers a 400 API error. The same operation works fine in normal interactive mode.
Error Messages
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.N.content.1.text: cache_control cannot be set for empty text blocks"}}
Sometimes followed by:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages: text content blocks must be non-empty"}}
Once the second error occurs, the session becomes completely unresponsive and must be killed and restarted.
Reproduction Steps
- Start Claude Code in remote-control mode:
``bash``
claude --remote-control --name MYAGENT --model claude-sonnet-4-6
- Send a message containing an image (e.g., paste a screenshot)
- Observe the 400 error
Expected Behavior
Images should be handled the same way as in normal interactive mode — no error.
Actual Behavior
Claude Code constructs the user message as [empty text block with cache_control, image block], which causes the Anthropic API to reject the request with a 400 error.
Key Observations
- Normal interactive mode (
claude): Pasting images works fine, no errors observed across many messages - Remote-control mode (
claude --remote-control): Every image paste triggers the 400 error - The message index varies (
messages.2,messages.20,messages.28, etc.) but the pattern is consistent - After the error, sending even plain text messages produces
text content blocks must be non-empty, requiring a full session restart
Environment
- Claude Code version:
2.1.114 - Platform: VPS (Ubuntu), also reproduced on Windows
- Model:
claude-sonnet-4-6
Workaround
Currently none available for --remote-control mode. Users must avoid sending images to sessions running in this mode.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗