{"record":{"id":"3139b113fb558210","repo":"sgl-project/sglang","slug":"conditions-index-frame-index-resolves-to-resol","errorCode":null,"errorMessage":"conditions[{index}].frame_index resolves to {resolved_frame_index}, already bound by conditions[{previous}]","messagePattern":"conditions\\[(.+?)\\]\\.frame_index resolves to (.+?), already bound by conditions\\[(.+?)\\]","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/resolved_plan.py","lineNumber":350,"sourceCode":"        resolved_frame_index = None\n        if rule.requires_frame_index:\n            if frame_index is None:\n                raise ValueError(f\"conditions[{index}].frame_index is required\")\n            semantic_frame_index = int(frame_index)\n            frame_count = int(shape[\"frame_count\"])\n            if semantic_frame_index == -1:\n                resolved_frame_index = frame_count - 1\n            elif 0 <= semantic_frame_index < frame_count:\n                resolved_frame_index = semantic_frame_index\n            else:\n                raise ValueError(\n                    f\"conditions[{index}].frame_index must be -1 or in \"\n                    f\"[0, {frame_count}) after 17n+5 frame alignment, got \"\n                    f\"{semantic_frame_index}\"\n                )\n            previous = seen_keyframe_pixel_indices.get(resolved_frame_index)\n            if previous is not None:\n                raise ValueError(\n                    f\"conditions[{index}].frame_index resolves to \"\n                    f\"{resolved_frame_index}, already bound by \"\n                    f\"conditions[{previous}]\"\n                )\n            seen_keyframe_pixel_indices[resolved_frame_index] = index\n            keyframe_semantic_indices.append(semantic_frame_index)\n            keyframe_pixel_indices.append(resolved_frame_index)\n        materials.append(\n            MiniMaxH3MaterialPlanItem(\n                condition_index=index,\n                role=str(cond[\"role\"]),\n                condition_type=str(cond[\"type\"]),\n                uri=str(cond[\"uri\"]),\n                material_chain=rule.material_chain,\n                frame_index=frame_index,\n                resolved_frame_index=resolved_frame_index,\n                start_time_seconds=float(cond.get(\"start_time_seconds\", 0.0)),\n            )","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/resolved_plan.py#L332-L368","documentation":"Two conditions may not resolve to the same pixel frame: e.g. frame_index 0 and a frame_count of 1 would both resolve to pixel frame 0. The second binding raises ValueError naming both condition indices.","triggerScenarios":"frame_count == 1 while two conditions use indices like 0 and -1 (both map to pixel frame 0); or duplicate explicit indices after -1 resolution.","commonSituations":"Very short clips where the 17n+5 alignment yields a single frame but the request still declares first+last keyframes; duplicated condition rows from a copy-paste.","solutions":["Drop one of the colliding conditions (use a single (0,) signature for one-frame videos)","Increase the requested duration/size so frame_count > 1","Deduplicate conditions by resolved frame index before calling resolve"],"exampleFix":"# before\nconditions = [{\"frame_index\":0},{\"frame_index\":-1}]  # frame_count==1\n# after\nconditions = [{\"frame_index\":0}]  # single anchor for one-frame video","handlingStrategy":"validation","validationCode":"resolved = [fc-1 if fi==-1 else fi for fi in fis]\nassert len(resolved) == len(set(resolved))","typeGuard":"def anchors_distinct(fis, frame_count) -> bool:\n    r = [frame_count-1 if f==-1 else f for f in fis]\n    return len(r) == len(set(r))","tryCatchPattern":null,"preventionTips":["For one-frame videos use a single anchor","Deduplicate conditions by resolved index"],"tags":["minimax-h3","frame-index","duplicate"],"backgroundTag":"duplicate-key-error","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}