{"record":{"id":"5bca30e2ed4383b6","repo":"sgl-project/sglang","slug":"strict-fl2va-packed-layout-requires-integer-keyfra","errorCode":null,"errorMessage":"strict fl2va packed layout requires integer keyframe_frame_indices","messagePattern":"strict fl2va packed layout requires integer keyframe_frame_indices","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/packed_sequence.py","lineNumber":55,"sourceCode":"\ndef _keyframe_cond_frame_indices(\n    *,\n    include_keyframe_cond: bool,\n    keyframe_frame_indices: list[int] | tuple[int, ...] | None,\n) -> list[int]:\n    if not include_keyframe_cond:\n        if keyframe_frame_indices is not None:\n            raise ValueError(\n                \"keyframe_frame_indices must be omitted when keyframe cond is not included\"\n            )\n        return []\n    if keyframe_frame_indices is None:\n        raise ValueError(\"strict fl2va packed layout requires keyframe_frame_indices\")\n    if any(\n        isinstance(value, bool) or not isinstance(value, int)\n        for value in keyframe_frame_indices\n    ):\n        raise ValueError(\n            \"strict fl2va packed layout requires integer keyframe_frame_indices\"\n        )\n    out = list(keyframe_frame_indices)\n    if tuple(out) not in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES:\n        raise ValueError(\n            \"strict fl2va packed layout requires keyframe_frame_indices in \"\n            f\"{MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES!r}, got {out!r}\"\n        )\n    return out\n\n\ndef _resolve_keyframe_frame_indices(\n    frame_indices: Sequence[int],\n    *,\n    frame_count: int | None,\n) -> list[int]:\n    if frame_indices and frame_count is None:\n        raise ValueError(","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/packed_sequence.py#L37-L73","documentation":"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.","triggerScenarios":"Passing indices as floats ([0.0, 8.0]), numpy scalars (np.int64), strings from JSON, or True/False values.","commonSituations":"JSON config where indices deserialize as strings or floats; NumPy arrays converted with tolist() but built from bool masks.","solutions":["Convert to plain ints: [int(i) for i in indices]","For numpy arrays use [int(x) for x in arr.tolist()]","Fix JSON schema to declare indices as integers"],"exampleFix":"# before\nidx = np.nonzero(mask)[0]  # np.int64 elements\nseq = minimax_h3_packed_sequence(..., keyframe_frame_indices=idx)\n# after\nidx = [int(x) for x in np.nonzero(mask)[0]]\nseq = minimax_h3_packed_sequence(..., keyframe_frame_indices=idx)","handlingStrategy":"type-guard","validationCode":"indices = [int(i) for i in indices] if indices is not None else None","typeGuard":"def are_int_indices(xs) -> bool:\n    return xs is None or all(type(x) is int for x in xs)","tryCatchPattern":"except ValueError as e: coerce to [int(i) for i in indices] and retry","preventionTips":["Coerce numpy/JSON values to plain int at the boundary","Never pass bool masks as indices"],"tags":["type-validation","numpy","minimax-h3"],"backgroundTag":"type-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}