{"record":{"id":"38e504e75ca9bcd9","repo":"sgl-project/sglang","slug":"unsupported-content-part-type-ptype-r","errorCode":null,"errorMessage":"unsupported content part type: {ptype!r}","messagePattern":"unsupported content part type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/parser/inkling_renderer.py","lineNumber":247,"sourceCode":"        if not isinstance(part, Mapping):\n            raise TypeError(f\"content part must be mapping, got {type(part).__name__}\")\n        ptype = part.get(\"type\")\n        if ptype in (None, \"text\", \"input_text\"):\n            text = part.get(\"text\", \"\")\n            yield (\"text\", text if isinstance(text, str) else \"\")\n        elif ptype in (\"thinking\", \"reasoning\"):\n            text = part.get(\"thinking\")\n            if text is None:\n                text = part.get(\"text\", \"\")\n            if not isinstance(text, str):\n                raise TypeError(\"Inkling thinking part payload must be a string\")\n            yield (\"thinking\", text)\n        elif ptype in _IMAGE_PART_TYPES:\n            yield (\"image\", \"\")\n        elif ptype in _AUDIO_PART_TYPES:\n            yield (\"audio\", \"\")\n        else:\n            raise ValueError(f\"unsupported content part type: {ptype!r}\")\n\n\ndef _format_reasoning_effort(reasoning_effort: float) -> str:\n    if isinstance(reasoning_effort, bool) or not isinstance(\n        reasoning_effort, (int, float)\n    ):\n        raise TypeError(\"Inkling reasoning_effort must be a number\")\n    value = float(reasoning_effort)\n    if not math.isfinite(value) or not 0.0 <= value <= 0.99:\n        raise ValueError(\"Inkling reasoning_effort must be finite and in [0.0, 0.99]\")\n    return f\"{round(value, 2):g}\"\n\n\ndef _expect_role(message: Mapping[str, Any]) -> str:\n    role = message.get(\"role\")\n    if role not in ROLE_MESSAGE_TOKENS:\n        raise ValueError(\n            f\"unsupported Inkling message role {role!r}; expected one of {sorted(ROLE_MESSAGE_TOKENS)}\"","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/parser/inkling_renderer.py#L229-L265","documentation":"Content part types are limited to text/input_text, thinking/reasoning, image types (_IMAGE_PART_TYPES), and audio types (_AUDIO_PART_TYPES). Any other 'type' value in a part raises ValueError with the offending type.","triggerScenarios":"Sending {\"type\":\"video_url\",...}, {\"type\":\"file\",...}, or {\"type\":\"input_audio\"} if not in the allowed audio set, in an Inkling-rendered conversation.","commonSituations":"Using OpenAI-style part types the Inkling renderer has not implemented, like video_url or file citation parts.","solutions":["Remove or convert unsupported part types to text","Check _IMAGE_PART_TYPES/_AUDIO_PART_TYPES in inkling_renderer.py for the accepted values","Request/implement support for the part type and add a branch plus tokens"],"exampleFix":"# before\n{\"type\":\"video_url\",\"video_url\":{\"url\":\"...\"}}\n# after\n{\"type\":\"text\",\"text\":\"[video attached]\"}","handlingStrategy":"validation","validationCode":"allowed = {None, \"text\", \"input_text\", \"thinking\", \"reasoning\"} | set(_IMAGE_PART_TYPES) | set(_AUDIO_PART_TYPES)\nfor m in messages:\n    c = m.get(\"content\", \"\")\n    if isinstance(c, list):\n        bad = [p for p in c if isinstance(p, dict) and p.get(\"type\") not in allowed]\n        assert not bad, bad","typeGuard":null,"tryCatchPattern":"try: render_inkling_messages(...)\nexcept ValueError as e: if \"unsupported content part type\" in str(e): coerce the offending part to text and retry","preventionTips":["Convert non-text/image/audio parts to text placeholders client-side","Check the renderer's allowed type sets before adopting exotic OpenAI part types"],"tags":["inkling","content-parts","unsupported-type"],"backgroundTag":"unsupported-content-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}