sgl-project/sglang · error · ValueError

keyframe denoising requires pixel_frame_indices resolved fro

Error message

keyframe denoising requires pixel_frame_indices resolved from the semantic anchors, got {pixel_indices!r} for frame_count={frame_count}

What it means

pixel_frame_indices must exactly equal the semantic anchors resolved against frame_count: each -1 maps to frame_count-1, other indices stay as-is. A mismatch raises ValueError showing both the got-list and frame_count.

Source

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

    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}"
        )

    entries = keyframe.get("keyframes")
    if (
        not isinstance(entries, list)
        or len(entries) != len(semantic_indices)
        or any(not isinstance(entry, Mapping) for entry in entries)
    ):
        raise ValueError(
            "keyframe denoising requires one encoded keyframe per semantic anchor"
        )
    if [entry.get("frame_index") for entry in entries] != list(semantic_indices):
        raise ValueError("encoded keyframes must remain in semantic anchor order")
    if [
        entry.get("resolved_frame_index") for entry in entries

View on GitHub (pinned to 0132848349)

Solutions

  1. Recompute pixel_frame_indices as [frame_count-1 if i==-1 else i for i in semantic_frame_indices] using the same frame_count stored in the payload
  2. Ensure frame alignment happens before pixel index resolution
  3. Rebuild the payload from the canonical plan rather than hand-assembling

Example fix

# before
payload["pixel_frame_indices"] = [0, -1]
# after
payload["pixel_frame_indices"] = [0, frame_count - 1]
Defensive patterns

Strategy: validation

Validate before calling

expected = [fc-1 if i==-1 else i for i in sem]
assert keyframe["pixel_frame_indices"] == expected

Type guard

def pixel_indices_consistent(kf) -> bool:
    fc = kf.get("frame_count")
    exp = [fc-1 if i==-1 else i for i in (kf.get("semantic_frame_indices") or ())]
    return kf.get("pixel_frame_indices") == exp

Prevention

When it happens

Trigger: pixel_frame_indices computed with a different frame_count than the one in the payload, off-by-one 'last frame' math, or indices left in semantic (-1) form.

Common situations: Producer stages caching pixel indices computed before frame alignment changed frame_count; hand-built payloads copying semantic indices into the pixel field.

Related errors


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