{"record":{"id":"8b3f424699eacc1a","repo":"sgl-project/sglang","slug":"keyframe-payload-requires-an-integer-frame-count","errorCode":null,"errorMessage":"keyframe payload requires an integer frame_count","messagePattern":"keyframe payload requires an integer frame_count","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/denoising.py","lineNumber":106,"sourceCode":"            )\n        return\n    if keyframe is None:\n        if task == \"fl2va\":\n            raise ValueError(\"fl2va denoising requires encoded keyframe condition rows\")\n        return\n    if not isinstance(keyframe, Mapping):\n        raise ValueError(\"encoded keyframe condition rows must be a mapping\")\n\n    semantic_indices = tuple(keyframe.get(\"semantic_frame_indices\") or ())\n    if semantic_indices not in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES:\n        raise ValueError(\n            \"keyframe denoising requires semantic_frame_indices in \"\n            f\"{MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES!r}, \"\n            f\"got {semantic_indices!r}\"\n        )\n    frame_count = keyframe.get(\"frame_count\")\n    if isinstance(frame_count, bool) or not isinstance(frame_count, int):\n        raise ValueError(\"keyframe payload requires an integer frame_count\")\n    if frame_count <= 1:\n        raise ValueError(\"keyframe payload frame_count must be greater than one\")\n    pixel_indices = keyframe.get(\"pixel_frame_indices\")\n    expected_pixel_indices = [\n        frame_count - 1 if index == -1 else index for index in semantic_indices\n    ]\n    if pixel_indices != expected_pixel_indices:\n        raise ValueError(\n            \"keyframe denoising requires pixel_frame_indices resolved from the \"\n            \"semantic anchors, \"\n            f\"got {pixel_indices!r} for frame_count={frame_count}\"\n        )\n\n    entries = keyframe.get(\"keyframes\")\n    if (\n        not isinstance(entries, list)\n        or len(entries) != len(semantic_indices)\n        or any(not isinstance(entry, Mapping) for entry in entries)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/denoising.py#L88-L124","documentation":"keyframe['frame_count'] must be a real int (bools explicitly rejected) describing the post-alignment frame count of the conditioned video.","triggerScenarios":"frame_count missing (None), a float like 129.0, a string \"129\", or a boolean sneaking in from JSON/flag code.","commonSituations":"JSON deserialization producing strings/floats; numpy integer types not matching isinstance(int); a bool used as a 1/0 flag in the payload.","solutions":["Coerce with int(...) when building the payload (guarding against bool)","Convert numpy integers via int() before attaching","Ensure the field is always set by the producing stage"],"exampleFix":"# before\npayload[\"frame_count\"] = float(n_frames)\n# after\npayload[\"frame_count\"] = int(n_frames)","handlingStrategy":"type-guard","validationCode":"fc = keyframe.get(\"frame_count\")\nassert not isinstance(fc, bool) and isinstance(fc, int)","typeGuard":"def is_int_frame_count(v) -> bool:\n    return not isinstance(v, bool) and isinstance(v, int)","tryCatchPattern":null,"preventionTips":["Coerce numpy ints to int() when building payloads","Never store frame_count as float/str"],"tags":["minimax-h3","keyframe","type-validation","frame-count"],"backgroundTag":"type-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}