SendMessage: structured message to a cross-session peer is denied and shown as a turn error

Status Closed — not planned
Reported on v2.1.296
Maintainer reply None cached
Activity 1 comment · opened Oct 12, 2026 · closed Oct 12, 2026

What happened

Claude Code 2.1.296. Session B received a plain-text cross-session message from session A (from was a uds:/tmp/cc-socks/<pid>.sock address). Session B called SendMessage with to set to that address and message set to a structured object, {"type":"shutdown_request"}.

The tool rejected the call:

structured messages cannot be sent cross-session — only plain text

The session UI showed that denial as the turn result:

Thought for 5s
Error: structured messages cannot be sent cross-session — only plain text

Plain text to the same uds address is accepted. Only the structured object form is rejected.

Why it happens

SendMessage validateInput in 2.1.296 (@anthropic-ai/claude-code) returns this string with errorCode 9 when message is an object and the recipient scheme is not other. The bridge scheme hits the same string earlier in the same function.

That disagrees with the rest of the contract the model is given:

  • The tool schema still lists a structured message object (shutdown_request, shutdown_response, plan_approval_response) with no cross-session exclusion.
  • The system prompt says to answer a shutdown_request / plan_approval_request frame with the structured object form, and to reply to a cross-session message by copying its from into to.

A string that only looks like protocol JSON is a different error (message text must not be a teammate protocol frame). The object form is the one that produces this exact text.

Expected

Keep cross-session delivery plain-text only. Do not offer the structured object for a uds/bridge recipient, and do not render this denial as a user-visible turn error. It should come back as a normal tool result so the model can resend the same note as plain text.

Repro

  1. Two Claude Code 2.1.296 sessions on one machine, cross-session messaging on.
  2. From session A, SendMessage a plain-text note to session B.
  3. From session B, SendMessage with to = A's uds:/tmp/cc-socks/<pid>.sock and message = {"type":"shutdown_request"} (object, not a string).
  4. The tool returns structured messages cannot be sent cross-session — only plain text, and the UI shows Error: structured messages cannot be sent cross-session — only plain text.

Evidence

  • Claude Code 2.1.296, binary /usr/local/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe
  • Session d8cf50ba-ca8f-417f-9f23-e8cf8642f799, 2026-10-12T16:54:01Z through 2026-10-12T16:55:16Z (repeated tool_use_error on the same call shape)
  • Peer address shape: uds:/tmp/cc-socks/4115885.sock

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗