sgl-project/sglang · error · ValueError

unsupported ref2va condition type {cond_type!r}

Error message

unsupported ref2va condition type {cond_type!r}

What it means

condition_labels drives ref2va emission and only 'image', 'audio', and 'video' condition types are supported; any other string raises this error.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py:296

                    "video reference requires block token counts and timestamps"
                )
            counts = video_counts_by_ref[video_seen - 1]
            timestamps = video_timestamps_by_ref[video_seen - 1]
            if not counts or not timestamps:
                raise ValueError(
                    "video reference requires block token counts and timestamps"
                )
            presentation.text(_text_ids(tokenizer, f"<Video {ordinal}>: "))
            _timestamped_video_blocks(
                presentation,
                tokenizer,
                counts=counts,
                timestamps=timestamps,
                context="",
                video_token_id=video_token_id,
            )
        else:
            raise ValueError(f"unsupported ref2va condition type {cond_type!r}")
    if image_seen != len(image_token_counts):
        raise ValueError("unused image_token_count entries")
    if video_seen != len(video_counts_by_ref):
        raise ValueError("unused video block token count entries")
    presentation.text(_text_ids(tokenizer, prompt))
    return presentation.build(return_video_mask=return_video_mask)


__all__ = [
    "minimax_h3_multi_image_presentation",
    "minimax_h3_ref2va_presentation",
    "minimax_h3_ref2va_video_presentation",
    "minimax_h3_text_only_ids",
]

View on GitHub (pinned to 0132848349)

Solutions

  1. Restrict condition type strings to exactly 'image', 'audio', 'video' (lowercase)
  2. Fix typos/casing in the plan generator
  3. If a new modality is needed, extend this function in the library rather than passing unknown types

Example fix

// before
condition_labels=[("Video", 1)]
// after
condition_labels=[("video", 1)]
Defensive patterns

Strategy: type-guard

Validate before calling

allowed = {"image", "audio", "video"}
assert all(t in allowed for t, _ in condition_labels)

Type guard

def valid_condition_labels(labels) -> bool:
    return all(isinstance(t, str) and t in {"image", "audio", "video"} for t, _ in labels)

Prevention

When it happens

Trigger: Passing condition_labels containing ("text", 1), ("Video", 1) (wrong case), or a typo like ("vidoe", 1).

Common situations: New condition types added to a plan format without presentation support; case mismatches; hand-built label tuples with typos.

Related errors


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