Bug: `--remote-control` mode causes 400 error when message contains image (cache_control on empty text block)

Resolved 💬 4 comments Opened Apr 19, 2026 by invader2023x Closed May 27, 2026

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

  1. Start Claude Code in remote-control mode:

``bash
claude --remote-control --name MYAGENT --model claude-sonnet-4-6
``

  1. Send a message containing an image (e.g., paste a screenshot)
  2. 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.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗