sgl-project/sglang · error · ValueError

keyframe_frame_indices must be omitted when keyframe cond is

Error message

keyframe_frame_indices must be omitted when keyframe cond is not included

What it means

The packed-sequence builder was called with include_keyframe_cond=False but keyframe_frame_indices was still supplied. The strict layout requires the two to agree.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/packed_sequence.py:45

    MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES,
)

_INTERP = 32
_T_GROUP = 5
_FRAME_PER_TOKEN = (1, 4, 4, 4, 4)
_FRAME_RESCALE = 5.0 / 3.0
_PATCH_H = 2
_PATCH_W = 2


def _keyframe_cond_frame_indices(
    *,
    include_keyframe_cond: bool,
    keyframe_frame_indices: list[int] | tuple[int, ...] | None,
) -> list[int]:
    if not include_keyframe_cond:
        if keyframe_frame_indices is not None:
            raise ValueError(
                "keyframe_frame_indices must be omitted when keyframe cond is not included"
            )
        return []
    if keyframe_frame_indices is None:
        raise ValueError("strict fl2va packed layout requires keyframe_frame_indices")
    if any(
        isinstance(value, bool) or not isinstance(value, int)
        for value in keyframe_frame_indices
    ):
        raise ValueError(
            "strict fl2va packed layout requires integer keyframe_frame_indices"
        )
    out = list(keyframe_frame_indices)
    if tuple(out) not in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES:
        raise ValueError(
            "strict fl2va packed layout requires keyframe_frame_indices in "
            f"{MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES!r}, got {out!r}"
        )

View on GitHub (pinned to 0132848349)

Solutions

  1. Pass keyframe_frame_indices=None whenever include_keyframe_cond=False
  2. In config handling, derive indices from the include flag
  3. Add a config lint rejecting the combination

Example fix

# before
seq = minimax_h3_packed_sequence(..., include_keyframe_cond=False, keyframe_frame_indices=[0, 8])
# after
seq = minimax_h3_packed_sequence(..., include_keyframe_cond=False, keyframe_frame_indices=None)
Defensive patterns

Strategy: validation

Validate before calling

if not include_keyframe_cond:
    assert keyframe_frame_indices is None, 'indices must be omitted when cond disabled'

Try / catch

except ValueError as e: drop indices and rebuild the sequence

Prevention

When it happens

Trigger: Calling minimax_h3_packed_sequence(..., include_keyframe_cond=False, keyframe_frame_indices=[0]) — indices present while keyframe conditioning is off.

Common situations: Config merging that defaults indices in regardless of mode; disabling keyframe cond late without clearing the indices setting.

Related errors


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