claude-code - 💡(How to fix) Fix [BUG] SendMessage broadcast (to: "*") rejects structured messages (shutdown_request) [1 participants]

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…
GitHub stats
anthropics/claude-code#46316Fetched 2026-04-11 06:23:30
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Error Message

Error: structured messages cannot be broadcast (to: "*")

Fix Action

Workaround

Send N individual SendMessage calls, one per teammate:

{"to": "teammate-1", "message": {"type": "shutdown_request", "reason": "cleanup"}}
{"to": "teammate-2", "message": {"type": "shutdown_request", "reason": "cleanup"}}
// ... repeat for each teammate

This works but is verbose, wastes tokens proportional to team size, and breaks down when the number of teammates is dynamic.

Code Example

Error: structured messages cannot be broadcast (to: "*")

---

Error: structured messages cannot be broadcast (to: "*")

---

{
     "to": "*",
     "message": { "type": "shutdown_request", "reason": "cleanup" }
   }

---

{"to": "teammate-1", "message": {"type": "shutdown_request", "reason": "cleanup"}}
{"to": "teammate-2", "message": {"type": "shutdown_request", "reason": "cleanup"}}
// ... repeat for each teammate
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this issue hasn't been reported yet
  • This is a single bug report (not multiple issues)

What's Wrong?

SendMessage with to: "*" (broadcast) rejects structured messages such as shutdown_request, returning:

Error: structured messages cannot be broadcast (to: "*")

When a team lead needs to shut down all teammates simultaneously (e.g., after a parallel scraping phase completes), broadcasting a shutdown_request is the natural approach. However, the framework explicitly blocks structured messages (JSON payloads with a type field) from being broadcast.

What Should Happen?

SendMessage with to: "*" should support structured messages — at minimum shutdown_request and shutdown_response, since "shut down all teammates" is the most common broadcast use case.

Broadcasting { "type": "shutdown_request", "reason": "cleanup" } to all teammates should work the same way as sending it to each teammate individually.

Error Messages/Logs

Error: structured messages cannot be broadcast (to: "*")

Steps to Reproduce

  1. Create a team with 3+ teammates using TeamCreate
  2. From the team lead, call SendMessage with:
    {
      "to": "*",
      "message": { "type": "shutdown_request", "reason": "cleanup" }
    }
  3. Observe error: structured messages cannot be broadcast

Workaround

Send N individual SendMessage calls, one per teammate:

{"to": "teammate-1", "message": {"type": "shutdown_request", "reason": "cleanup"}}
{"to": "teammate-2", "message": {"type": "shutdown_request", "reason": "cleanup"}}
// ... repeat for each teammate

This works but is verbose, wastes tokens proportional to team size, and breaks down when the number of teammates is dynamic.

Claude Model

claude-sonnet-4-20250514

Is this a regression?

Unknown — structured messages and broadcast may have always had this restriction.

Claude Code Version

2.1.32+

Platform

Anthropic API (1p)

Operating System

Linux (Ubuntu 22.04)

Terminal/Shell

bash

Additional Information

Related: #30140 (shared channel proposal) addresses the broader coordination problem, but this specific bug — broadcast rejecting structured messages — is an independent issue with the existing SendMessage primitive.

The restriction seems intentional but overly broad. Even if arbitrary structured messages shouldn't be broadcast, protocol messages like shutdown_request (which are designed for lifecycle management) should be exempt since shutting down all teammates is a core operation.

extent analysis

TL;DR

Send individual SendMessage calls to each teammate as a workaround for the current restriction on broadcasting structured messages.

Guidance

  • Identify the teammates that need to receive the shutdown_request and send individual messages to each one using the SendMessage API.
  • Consider implementing a loop to iterate over the teammates and send the message to each one, to avoid manual repetition and make the code more scalable.
  • Review the related issue #30140 for potential future improvements to the shared channel proposal, which may address the broader coordination problem.
  • Verify that the workaround works by checking the response from each teammate and ensuring that they all receive the shutdown_request message correctly.

Example

// Example of sending individual messages to each teammate
teammates = ["teammate-1", "teammate-2", "teammate-3"];
message = {"type": "shutdown_request", "reason": "cleanup"};
for (teammate of teammates) {
  SendMessage({"to": teammate, "message": message});
}

Notes

The current restriction on broadcasting structured messages may be intentional, but it seems overly broad. The workaround of sending individual messages to each teammate is verbose and may waste tokens, but it is a functional solution until a more robust fix is implemented.

Recommendation

Apply the workaround of sending individual SendMessage calls to each teammate, as it is a functional solution that can be implemented immediately, even if it is not the most efficient or scalable approach.

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