sgl-project/sglang · error · ValueError

conditions[{index}].frame_index resolves to {resolved_frame_

Error message

conditions[{index}].frame_index resolves to {resolved_frame_index}, already bound by conditions[{previous}]

What it means

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.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/resolved_plan.py:350

        resolved_frame_index = None
        if rule.requires_frame_index:
            if frame_index is None:
                raise ValueError(f"conditions[{index}].frame_index is required")
            semantic_frame_index = int(frame_index)
            frame_count = int(shape["frame_count"])
            if semantic_frame_index == -1:
                resolved_frame_index = frame_count - 1
            elif 0 <= semantic_frame_index < frame_count:
                resolved_frame_index = semantic_frame_index
            else:
                raise ValueError(
                    f"conditions[{index}].frame_index must be -1 or in "
                    f"[0, {frame_count}) after 17n+5 frame alignment, got "
                    f"{semantic_frame_index}"
                )
            previous = seen_keyframe_pixel_indices.get(resolved_frame_index)
            if previous is not None:
                raise ValueError(
                    f"conditions[{index}].frame_index resolves to "
                    f"{resolved_frame_index}, already bound by "
                    f"conditions[{previous}]"
                )
            seen_keyframe_pixel_indices[resolved_frame_index] = index
            keyframe_semantic_indices.append(semantic_frame_index)
            keyframe_pixel_indices.append(resolved_frame_index)
        materials.append(
            MiniMaxH3MaterialPlanItem(
                condition_index=index,
                role=str(cond["role"]),
                condition_type=str(cond["type"]),
                uri=str(cond["uri"]),
                material_chain=rule.material_chain,
                frame_index=frame_index,
                resolved_frame_index=resolved_frame_index,
                start_time_seconds=float(cond.get("start_time_seconds", 0.0)),
            )

View on GitHub (pinned to 0132848349)

Solutions

  1. Drop one of the colliding conditions (use a single (0,) signature for one-frame videos)
  2. Increase the requested duration/size so frame_count > 1
  3. Deduplicate conditions by resolved frame index before calling resolve

Example fix

# before
conditions = [{"frame_index":0},{"frame_index":-1}]  # frame_count==1
# after
conditions = [{"frame_index":0}]  # single anchor for one-frame video
Defensive patterns

Strategy: validation

Validate before calling

resolved = [fc-1 if fi==-1 else fi for fi in fis]
assert len(resolved) == len(set(resolved))

Type guard

def anchors_distinct(fis, frame_count) -> bool:
    r = [frame_count-1 if f==-1 else f for f in fis]
    return len(r) == len(set(r))

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/3139b113fb558210. Report an issue: GitHub.