sgl-project/sglang · error · ValueError

keyframe denoising requires semantic_frame_indices in {MINIM

Error message

keyframe denoising requires semantic_frame_indices in {MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES!r}, got {semantic_indices!r}

What it means

keyframe['semantic_frame_indices'] (after tuple coercion of a possibly-empty value) must be one of MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES — (0,), (-1,), or (0, -1). Anything else, including empty, raises this ValueError.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/denoising.py:99

    """Reject stale/middle/reordered keyframe payloads at the DiT sink."""

    task = None if plan is None else str(plan.task)
    if task not in {"fl2va", "ref2va"}:
        if keyframe is not None:
            raise ValueError(
                "keyframe condition rows require plan.task='fl2va' or 'ref2va'"
            )
        return
    if keyframe is None:
        if task == "fl2va":
            raise ValueError("fl2va denoising requires encoded keyframe condition rows")
        return
    if not isinstance(keyframe, Mapping):
        raise ValueError("encoded keyframe condition rows must be a mapping")

    semantic_indices = tuple(keyframe.get("semantic_frame_indices") or ())
    if semantic_indices not in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES:
        raise ValueError(
            "keyframe denoising requires semantic_frame_indices in "
            f"{MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES!r}, "
            f"got {semantic_indices!r}"
        )
    frame_count = keyframe.get("frame_count")
    if isinstance(frame_count, bool) or not isinstance(frame_count, int):
        raise ValueError("keyframe payload requires an integer frame_count")
    if frame_count <= 1:
        raise ValueError("keyframe payload frame_count must be greater than one")
    pixel_indices = keyframe.get("pixel_frame_indices")
    expected_pixel_indices = [
        frame_count - 1 if index == -1 else index for index in semantic_indices
    ]
    if pixel_indices != expected_pixel_indices:
        raise ValueError(
            "keyframe denoising requires pixel_frame_indices resolved from the "
            "semantic anchors, "
            f"got {pixel_indices!r} for frame_count={frame_count}"

View on GitHub (pinned to 0132848349)

Solutions

  1. Normalize semantic_frame_indices to (0,), (-1,), or (0, -1)
  2. Ensure the field is present and populated (its absence coerces to () which fails)
  3. Keep semantic (0/-1) indices separate from resolved pixel indices

Example fix

# before
payload["semantic_frame_indices"] = [0, frame_count - 1]
# after
payload["semantic_frame_indices"] = [0, -1]  # semantic anchors only
Defensive patterns

Strategy: validation

Validate before calling

assert tuple(kf.get("semantic_frame_indices") or ()) in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES

Type guard

def valid_semantic_indices(vals) -> bool:
    return tuple(vals or ()) in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES

Prevention

When it happens

Trigger: An empty semantic_frame_indices list, or values like (1,), (0, 1), or (-1, 0) in the encoded keyframe payload.

Common situations: Producer stages emitting raw request indices without normalizing; ordering swapped between semantic and pixel index lists; partial payloads where the indices field is absent (defaults to empty).

Related errors


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