{"record":{"id":"7109193da4bf1d3b","repo":"sgl-project/sglang","slug":"unsupported-inkling-render-part-kind-kind-r","errorCode":null,"errorMessage":"unsupported Inkling render part kind: {kind!r}","messagePattern":"unsupported Inkling render part kind: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/parser/inkling_renderer.py","lineNumber":210,"sourceCode":"        input_ids.extend(tokenizer.encode_text(text))\n    elif kind == \"image\":\n        input_ids.append(tokenizer.encode_special(CONTENT_IMAGE))\n        input_ids.append(IMAGE_TOKEN_ID)\n    elif kind == \"audio\":\n        input_ids.append(tokenizer.encode_special(CONTENT_AUDIO_INPUT))\n        input_ids.append(AUDIO_TOKEN_ID)\n        input_ids.append(tokenizer.encode_special(AUDIO_END))\n    elif kind == \"thinking\":\n        input_ids.append(tokenizer.encode_special(CONTENT_THINKING))\n        input_ids.extend(tokenizer.encode_text(text))\n    elif kind == \"xml\":\n        input_ids.append(tokenizer.encode_special(CONTENT_XML))\n        input_ids.extend(tokenizer.encode_text(text))\n    elif kind == \"invoke_tool_json\":\n        input_ids.append(tokenizer.encode_special(CONTENT_INVOKE_TOOL_JSON))\n        input_ids.extend(tokenizer.encode_text(text))\n    else:\n        raise ValueError(f\"unsupported Inkling render part kind: {kind!r}\")\n\n    input_ids.append(tokenizer.encode_special(END_MESSAGE))\n\n\ndef _iter_render_parts(content: Any):\n    \"\"\"Yield ordered ``(kind, text)`` pairs from message content.\"\"\"\n    if content is None:\n        return\n    if isinstance(content, str):\n        if content:\n            yield (\"text\", content)\n        return\n    if not isinstance(content, Sequence) or isinstance(content, (bytes, bytearray)):\n        raise TypeError(\"message content must be a string or a sequence of parts\")\n    for part in content:\n        if isinstance(part, str):\n            yield (\"text\", part)\n            continue","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/parser/inkling_renderer.py#L192-L228","documentation":"_append_message encodes each (role, kind, text) part; only specific kinds (text, thinking, image, audio, invoke_tool_json, etc.) are supported. An unrecognized kind — usually produced by a bug or a new part type not wired into the renderer — raises ValueError.","triggerScenarios":"Internal: extending _iter_render_parts to yield a new kind (e.g. 'video') without adding a branch in _append_message; externally reachable only if a content part type maps to an unhandled kind.","commonSituations":"Contributors adding a new multimodal part type to the Inkling renderer and forgetting the encoding branch.","solutions":["Add an elif branch in _append_message for the new kind with the appropriate special tokens","Verify every kind yielded by _iter_render_parts has a matching branch"],"exampleFix":"# before\nyield (\"video\", \"\")\n# ...no branch in _append_message\n# after\nelif kind == \"video\":\n    input_ids.append(tokenizer.encode_special(CONTENT_VIDEO))\n    input_ids.extend(tokenizer.encode_text(text))","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try: render_inkling_messages(...)\nexcept ValueError as e: if \"unsupported Inkling render part kind\" in str(e): fail fast with the part kind in the log","preventionTips":["When adding a part type, add both the _iter_render_parts branch and the _append_message branch","Unit-test every yielded kind round-trips through _append_message"],"tags":["inkling","internal","parser"],"backgroundTag":"unsupported-content-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}