sgl-project/sglang · error · ValueError

strict fl2va packed layout requires integer keyframe_frame_i

Error message

strict fl2va packed layout requires integer keyframe_frame_indices

What it means

keyframe_frame_indices contains non-int elements (bools are explicitly rejected too, since bool is an int subclass). The strict layout requires plain Python ints.

Source

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

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


def _resolve_keyframe_frame_indices(
    frame_indices: Sequence[int],
    *,
    frame_count: int | None,
) -> list[int]:
    if frame_indices and frame_count is None:
        raise ValueError(

View on GitHub (pinned to 0132848349)

Solutions

  1. Convert to plain ints: [int(i) for i in indices]
  2. For numpy arrays use [int(x) for x in arr.tolist()]
  3. Fix JSON schema to declare indices as integers

Example fix

# before
idx = np.nonzero(mask)[0]  # np.int64 elements
seq = minimax_h3_packed_sequence(..., keyframe_frame_indices=idx)
# after
idx = [int(x) for x in np.nonzero(mask)[0]]
seq = minimax_h3_packed_sequence(..., keyframe_frame_indices=idx)
Defensive patterns

Strategy: type-guard

Validate before calling

indices = [int(i) for i in indices] if indices is not None else None

Type guard

def are_int_indices(xs) -> bool:
    return xs is None or all(type(x) is int for x in xs)

Try / catch

except ValueError as e: coerce to [int(i) for i in indices] and retry

Prevention

When it happens

Trigger: Passing indices as floats ([0.0, 8.0]), numpy scalars (np.int64), strings from JSON, or True/False values.

Common situations: JSON config where indices deserialize as strings or floats; NumPy arrays converted with tolist() but built from bool masks.

Related errors


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