{"record":{"id":"aeeecdfae61b1f37","repo":"sgl-project/sglang","slug":"keyframe-denoising-requires-one-encoded-keyframe-p","errorCode":null,"errorMessage":"keyframe denoising requires one encoded keyframe per semantic anchor","messagePattern":"keyframe denoising requires one encoded keyframe per semantic anchor","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":126,"sourceCode":"        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\n    ] != expected_pixel_indices:\n        raise ValueError(\n            \"encoded keyframes must carry matching resolved_frame_index values\"\n        )\n\n    latent_h = int(keyframe.get(\"latent_h\") or 0)\n    latent_w = int(keyframe.get(\"latent_w\") or 0)\n    rows = keyframe.get(\"rows\")\n    expected_rows = len(semantic_indices) * (latent_h // 2) * (latent_w // 2)\n    if (\n        latent_h <= 0\n        or latent_w <= 0","sourceCodeStart":108,"sourceCodeEnd":144,"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#L108-L144","documentation":"keyframe['keyframes'] must be a list with exactly one encoded entry per semantic anchor, and each entry must be a Mapping. Any non-list, wrong length, or non-mapping entries raise ValueError.","triggerScenarios":"An empty keyframes list with 2 anchors, 3 entries for 2 anchors, entries as tuples/classes instead of dicts, or the field missing (None).","commonSituations":"Dropping one encoded keyframe when its source image failed to load; producers emitting dataclasses or namedtuples instead of dict-like entries.","solutions":["Ensure exactly len(semantic_frame_indices) dict entries in keyframes","Wrap non-mapping entries with dataclasses.asdict()/dict(...) or skip failures upstream by reducing anchors","Fail the whole request if any keyframe source can't be encoded, rather than emitting a short list"],"exampleFix":"# before\npayload[\"keyframes\"] = [enc0]  # 2 anchors, 1 entry\n# after\npayload[\"keyframes\"] = [enc0, enc1]  # one per semantic anchor","handlingStrategy":"validation","validationCode":"kfs = keyframe.get(\"keyframes\")\nassert isinstance(kfs, list) and len(kfs) == len(sem) and all(isinstance(e, Mapping) for e in kfs)","typeGuard":"def keyframes_valid(kf) -> bool:\n    kfs = kf.get(\"keyframes\")\n    sem = kf.get(\"semantic_frame_indices\") or ()\n    return isinstance(kfs, list) and len(kfs) == len(sem) and all(isinstance(e, Mapping) for e in kfs)","tryCatchPattern":null,"preventionTips":["Fail the whole request if any keyframe source fails to encode","Convert dataclass entries to dicts before attaching"],"tags":["minimax-h3","keyframe","cardinality","type-validation"],"backgroundTag":"data-consistency-error","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}