{"record":{"id":"8c60cc48cea3b04e","repo":"sgl-project/sglang","slug":"keyframe-denoising-requires-pixel-frame-indices-re","errorCode":null,"errorMessage":"keyframe denoising requires pixel_frame_indices resolved from the semantic anchors, got {pixel_indices!r} for frame_count={frame_count}","messagePattern":"keyframe denoising requires pixel_frame_indices resolved from the semantic anchors, got (.+?) for 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":114,"sourceCode":"\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)\n    ):\n        raise ValueError(\n            \"keyframe denoising requires one encoded keyframe per semantic anchor\"\n        )\n    if [entry.get(\"frame_index\") for entry in entries] != list(semantic_indices):\n        raise ValueError(\"encoded keyframes must remain in semantic anchor order\")\n    if [\n        entry.get(\"resolved_frame_index\") for entry in entries","sourceCodeStart":96,"sourceCodeEnd":132,"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#L96-L132","documentation":"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.","triggerScenarios":"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.","commonSituations":"Producer stages caching pixel indices computed before frame alignment changed frame_count; hand-built payloads copying semantic indices into the pixel field.","solutions":["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","Ensure frame alignment happens before pixel index resolution","Rebuild the payload from the canonical plan rather than hand-assembling"],"exampleFix":"# before\npayload[\"pixel_frame_indices\"] = [0, -1]\n# after\npayload[\"pixel_frame_indices\"] = [0, frame_count - 1]","handlingStrategy":"validation","validationCode":"expected = [fc-1 if i==-1 else i for i in sem]\nassert keyframe[\"pixel_frame_indices\"] == expected","typeGuard":"def pixel_indices_consistent(kf) -> bool:\n    fc = kf.get(\"frame_count\")\n    exp = [fc-1 if i==-1 else i for i in (kf.get(\"semantic_frame_indices\") or ())]\n    return kf.get(\"pixel_frame_indices\") == exp","tryCatchPattern":null,"preventionTips":["Compute pixel indices from the same frame_count stored in the payload","Run alignment before resolving pixel indices"],"tags":["minimax-h3","keyframe","index-consistency"],"backgroundTag":"data-consistency-error","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}