{"record":{"id":"9c64251fd719c19f","repo":"sgl-project/sglang","slug":"unknown-input-type-response-msg-type","errorCode":null,"errorMessage":"Unknown input type: {response_msg['type']}","messagePattern":"Unknown input type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/entrypoints/harmony_utils.py","lineNumber":199,"sourceCode":"                call_response = prev_response\n                break\n        if call_response is None:\n            raise ValueError(f\"No call message found for {call_id}\")\n        msg = Message.from_author_and_content(\n            Author.new(Role.TOOL, f\"functions.{call_response.name}\"),\n            response_msg[\"output\"],\n        )\n    elif response_msg[\"type\"] == \"reasoning\":\n        content = response_msg[\"content\"]\n        assert len(content) == 1\n        msg = Message.from_role_and_content(Role.ASSISTANT, content[0][\"text\"])\n    elif response_msg[\"type\"] == \"function_call\":\n        msg = Message.from_role_and_content(Role.ASSISTANT, response_msg[\"arguments\"])\n        msg = msg.with_channel(\"commentary\")\n        msg = msg.with_recipient(f\"functions.{response_msg['name']}\")\n        msg = msg.with_content_type(\"json\")\n    else:\n        raise ValueError(f\"Unknown input type: {response_msg['type']}\")\n    return msg\n\n\ndef parse_response_output(output: ResponseOutputItem) -> Message:\n    if isinstance(output, ResponseOutputMessage):\n        role = output.role\n        contents = [TextContent(text=c.text) for c in output.content]\n        msg = Message.from_role_and_contents(role, contents)\n        return msg\n    elif isinstance(output, ResponseFunctionToolCall):\n        msg = Message.from_role_and_content(Role.ASSISTANT, output.arguments)\n        msg = msg.with_channel(\"commentary\")\n        msg = msg.with_recipient(output.name)\n        msg = msg.with_content_type(\"json\")\n        return msg\n    else:\n        raise ValueError(f\"Unknown output type: {type(output)}\")\n","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/entrypoints/harmony_utils.py#L181-L217","documentation":"parse_response_input only understands response input item types 'message', 'reasoning', and 'function_call'; anything else falls through to this ValueError. The type field of each response_msg dict is used as the dispatch key, so unsupported or misspelled types are rejected.","triggerScenarios":"Feeding _construct_input_messages_with_harmony a response item whose ['type'] is e.g. 'function_call_output' handled elsewhere, 'web_search_call', 'image', or a typo like 'FunctionCall'.","commonSituations":"Forwarding raw OpenAI Responses API item lists that include newer item types the parser doesn't handle; client-side typos in the discriminator field; version drift between the client's item schema and sglang's harmony parser.","solutions":["Filter or transform input items to only the supported types ('message', 'reasoning', 'function_call') before calling the API","Fix the typo in the type discriminator field","Upgrade sglang — newer parsers may accept additional item types"],"exampleFix":"# before\nitems = [{\"type\": \"web_search_call\", ...}, ...]\n# after\nitems = [i for i in items if i[\"type\"] in {\"message\", \"reasoning\", \"function_call\"}]","handlingStrategy":"type-guard","validationCode":"SUPPORTED_INPUT_TYPES = {\"message\", \"reasoning\", \"function_call\"}\nitems = [i for i in items if i.get(\"type\") in SUPPORTED_INPUT_TYPES]","typeGuard":"def is_supported_response_input(item) -> bool:\n    return isinstance(item, dict) and item.get(\"type\") in {\"message\", \"reasoning\", \"function_call\"}","tryCatchPattern":"try:\n    msg = parse_response_input(item)\nexcept ValueError:\n    msg = None  # skip or log unsupported item\n","preventionTips":["Whitelist item types before sending conversation history","Log unsupported types in development to catch schema drift early"],"tags":["harmony","input-validation","discriminator","sglang"],"backgroundTag":"unsupported-message-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}