sgl-project/sglang · error · ValueError
Unknown recipient: {message.recipient}
Error message
Unknown recipient: {message.recipient} What it means
Inside the commentary-channel branch, a message's recipient is not any of the recognized targets (analysis, functions.*, browser.*), so parse_output_message cannot decide what output item to build and raises.
Source
Thrown at python/sglang/srt/entrypoints/harmony_utils.py:329
output_items.append(response_item)
elif message.recipient.startswith("python") or message.recipient.startswith(
"browser"
):
for content in message.content:
reasoning_item = ResponseReasoningItem(
id=f"rs_{random_uuid()}",
type="reasoning",
summary=[],
content=[
ResponseReasoningTextContent(
text=content.text, type="reasoning_text"
)
],
status=None,
)
output_items.append(reasoning_item)
else:
raise ValueError(f"Unknown recipient: {message.recipient}")
elif message.channel == "final":
contents = []
for content in message.content:
output_text = ResponseOutputText(
text=content.text,
annotations=[], # TODO
type="output_text",
logprobs=None, # TODO
)
contents.append(output_text)
text_item = ResponseOutputMessage(
id=f"msg_{random_uuid()}",
content=contents,
role=message.author.role,
status="completed",
type="message",
)
output_items.append(text_item)View on GitHub (pinned to 0132848349)
Solutions
- Ensure tool recipients are namespaced as functions.<name> or browser.<action>
- Adjust prompts/tool definitions so the model emits only recognized recipients
- Extend parse_output_message with a branch for the new recipient namespace
Example fix
# before
msg = msg.with_recipient("python")
# after
msg = msg.with_recipient("functions.run_python") Defensive patterns
Strategy: validation
Validate before calling
KNOWN_PREFIXES = ("functions.", "browser.")
KNOWN_RECIPIENTS = {"analysis"}
assert message.recipient is None or message.recipient in KNOWN_RECIPIENTS or message.recipient.startswith(KNOWN_PREFIXES) Type guard
def is_known_recipient(recipient) -> bool:
if recipient is None:
return True
return recipient == "analysis" or recipient.startswith(("functions.", "browser.")) Try / catch
try:
items = parse_output_message(message)
except ValueError as e:
if "Unknown recipient" in str(e):
return [] # skip unrecognized routing
raise Prevention
- Namespace all tool recipients as functions.<name>
- Review system prompts for recipient conventions the runtime can't route
When it happens
Trigger: A commentary message with an unrecognized recipient string, e.g. 'python' or a hallucinated tool name not prefixed with functions. or browser., reaching parse_output_message.
Common situations: Model hallucinating recipient names; custom system prompts introducing new recipient conventions; new tool namespaces added without parser support.
Related errors
- Unknown channel: {message.channel}
- No call message found for {call_id}
- Unknown input type: {response_msg['type']}
- Unknown output type: {type(output)}
- Invalid number of contents in browser message
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/749f267e0aafb840.
Report an issue: GitHub.