sgl-project/sglang · error · ValueError
Unknown channel: {message.channel}
Error message
Unknown channel: {message.channel} What it means
parse_output_message only converts messages on the 'commentary' and 'final' channels; a message on any other channel (e.g. 'analysis' or a typo) falls through to this ValueError. The channel field is the top-level dispatch key for output formatting.
Source
Thrown at python/sglang/srt/entrypoints/harmony_utils.py:349
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)
else:
raise ValueError(f"Unknown channel: {message.channel}")
return output_items
def parse_remaining_state(parser: StreamableParser):
if not parser.current_content:
return []
if parser.current_role != Role.ASSISTANT:
return []
current_recipient = parser.current_recipient
if current_recipient is not None and current_recipient.startswith("browser."):
return []
if parser.current_channel == "analysis":
reasoning_item = ResponseReasoningItem(
id=f"rs_{random_uuid()}",
type="reasoning",
summary=[],
content=[View on GitHub (pinned to 0132848349)
Solutions
- Normalize message.channel to 'commentary' or 'final' before parsing
- If the model emits a legitimate new channel, add a handling branch in harmony_utils.py
- Upgrade sglang to match the harmony format version your model was trained on
Example fix
# before msg = msg.copy_with(channel="analysis") # after msg = msg.copy_with(channel="commentary")
Defensive patterns
Strategy: validation
Validate before calling
assert message.channel in {"commentary", "final"}, f"unexpected channel {message.channel!r}" Type guard
def is_supported_channel(message) -> bool:
return message.channel in {"commentary", "final"} Try / catch
try:
items = parse_output_message(message)
except ValueError as e:
if "Unknown channel" in str(e):
message = message.copy_with(channel="commentary")
items = parse_output_message(message)
else:
raise Prevention
- Normalize channel to commentary/final in harmony post-processing
- Keep the harmony format version aligned between model and sglang runtime
When it happens
Trigger: A parsed harmony Message whose channel is anything other than 'commentary' or 'final' when handed to _make_response_output_items_with_harmony.
Common situations: Malformed model output emitting an unexpected channel token; older/newer harmony format versions using different channel names; custom harmony post-processing setting wrong channel values.
Related errors
- Unknown recipient: {message.recipient}
- 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/885207434c5c5004.
Report an issue: GitHub.