sgl-project/sglang · error · ValueError

Unsupported preprocessed video item: {item_type}

Error message

Unsupported preprocessed video item: {item_type}

What it means

Raised by _render_video_content when iterating the preprocessed video content items (from the model's HF preprocessor) and encountering an item whose 'type' is neither one of the known types (image marker, audio_url, etc.). It signals a version/content mismatch between the bundled video preprocessor output and the processor's renderer.

Source

Thrown at python/sglang/srt/multimodal/processors/dots_note_omni.py:273

        content: list[dict],
    ) -> tuple[str, dict[str, tuple[Modality, str]]]:
        """Insert one expanded video while retaining its media ordering."""
        rendered = []
        media = {}
        for item in content:
            item_type = item.get("type")
            if item_type == "text":
                rendered.append(item.get("text", ""))
            elif item_type == "image_url":
                marker = f"<|sglang_dots_video_{video_index}_image_{len(media)}|>"
                media[marker] = (Modality.IMAGE, item["image_url"]["url"])
                rendered.append(marker)
            elif item_type == "audio_url":
                marker = f"<|sglang_dots_video_{video_index}_audio_{len(media)}|>"
                media[marker] = (Modality.AUDIO, item["audio_url"]["url"])
                rendered.append(marker)
            else:
                raise ValueError(f"Unsupported preprocessed video item: {item_type}")

        expanded = "".join(rendered)
        # The adapter appends the question to every flattened video. Keep the
        # question already rendered by the chat template so multiple videos do
        # not duplicate it.
        if question:
            question_pos = expanded.rfind(question)
            if question_pos >= 0:
                expanded = (
                    expanded[:question_pos] + expanded[question_pos + len(question) :]
                )

        placeholder = self.video_placeholder_regex.search(input_text)
        if placeholder is not None:
            input_text = (
                input_text[: placeholder.start()]
                + expanded
                + input_text[placeholder.end() :]

View on GitHub (pinned to 0132848349)

Solutions

  1. Pin the transformers / model repo versions the Dots Note Omni processor was built against
  2. Check the item['type'] value in the traceback and update/extend _render_video_content in dots_note_omni.py to handle it
  3. Retry with the bundled test video (process_sample_video path) to isolate repo-vs-code drift

Example fix

// before
elif item_type == "audio_url": ...
else: raise ValueError(...)
// after (extend renderer for the new type)
elif item_type == "video_url":
    marker = f"<|sglang_dots_video_{video_index}_url|>"; media[marker] = (Modality.VIDEO, item["video_url"]["url"]); rendered.append(marker)
Defensive patterns

Strategy: try-catch

Validate before calling

ALLOWED = {'image', 'audio_url'}  # adapt to renderer's known types
assert all(item.get('type') in ALLOWED for item in content), 'unsupported item type in preprocessed content'

Try / catch

try:
    out = await processor.process_mm_data_async(...)
except ValueError as e:
    if 'Unsupported preprocessed video item' in str(e):
        # pin/rollback transformers or model repo; inspect item type in logs
        raise RuntimeError(f'preprocessor/renderer version drift: {e}') from e
    raise

Prevention

When it happens

Trigger: The dots_note_omni_video_core preprocessor emits content dicts with an unexpected 'type' key (e.g. new item kinds after a HF transformers version change), and _render_video_content hits the final else branch.

Common situations: Upgrading transformers or the model repo changes the video preprocessing output schema; the pinned sglang renderer only knows image/audio_url items. Reproduce with any video request through process_mm_data_async.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/45edd74219f8a2db. Report an issue: GitHub.