{"record":{"id":"749f267e0aafb840","repo":"sgl-project/sglang","slug":"unknown-recipient-message-recipient","errorCode":null,"errorMessage":"Unknown recipient: {message.recipient}","messagePattern":"Unknown recipient: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/entrypoints/harmony_utils.py","lineNumber":329,"sourceCode":"                output_items.append(response_item)\n        elif message.recipient.startswith(\"python\") or message.recipient.startswith(\n            \"browser\"\n        ):\n            for content in message.content:\n                reasoning_item = ResponseReasoningItem(\n                    id=f\"rs_{random_uuid()}\",\n                    type=\"reasoning\",\n                    summary=[],\n                    content=[\n                        ResponseReasoningTextContent(\n                            text=content.text, type=\"reasoning_text\"\n                        )\n                    ],\n                    status=None,\n                )\n                output_items.append(reasoning_item)\n        else:\n            raise ValueError(f\"Unknown recipient: {message.recipient}\")\n    elif message.channel == \"final\":\n        contents = []\n        for content in message.content:\n            output_text = ResponseOutputText(\n                text=content.text,\n                annotations=[],  # TODO\n                type=\"output_text\",\n                logprobs=None,  # TODO\n            )\n            contents.append(output_text)\n        text_item = ResponseOutputMessage(\n            id=f\"msg_{random_uuid()}\",\n            content=contents,\n            role=message.author.role,\n            status=\"completed\",\n            type=\"message\",\n        )\n        output_items.append(text_item)","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/entrypoints/harmony_utils.py#L311-L347","documentation":"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.","triggerScenarios":"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.","commonSituations":"Model hallucinating recipient names; custom system prompts introducing new recipient conventions; new tool namespaces added without parser support.","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"],"exampleFix":"# before\nmsg = msg.with_recipient(\"python\")\n# after\nmsg = msg.with_recipient(\"functions.run_python\")","handlingStrategy":"validation","validationCode":"KNOWN_PREFIXES = (\"functions.\", \"browser.\")\nKNOWN_RECIPIENTS = {\"analysis\"}\nassert message.recipient is None or message.recipient in KNOWN_RECIPIENTS or message.recipient.startswith(KNOWN_PREFIXES)","typeGuard":"def is_known_recipient(recipient) -> bool:\n    if recipient is None:\n        return True\n    return recipient == \"analysis\" or recipient.startswith((\"functions.\", \"browser.\"))","tryCatchPattern":"try:\n    items = parse_output_message(message)\nexcept ValueError as e:\n    if \"Unknown recipient\" in str(e):\n        return []  # skip unrecognized routing\n    raise","preventionTips":["Namespace all tool recipients as functions.<name>","Review system prompts for recipient conventions the runtime can't route"],"tags":["harmony","recipient-routing","message-parsing","sglang"],"backgroundTag":"unknown-message-recipient","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}