sgl-project/sglang · error · ValueError
conditions for task {task!r} must include one or two ordered
Error message
conditions for task {task!r} must include one or two ordered image/keyframe entries with frame_index [0], [-1], or [0, -1], got {list(frame_indices)!r} What it means
MiniMax-H3 first/last-frame (fl2va / ref2va) tasks require exactly one or two keyframe conditions with frame_index values matching [0], [-1], or [0, -1] in order. This error fires when the collected keyframe frame_index tuple deviates from MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py:263
)
entry["start_time_seconds"] = start_time_seconds
normalized.append(entry)
return normalized
def _validate_keyframe_conditions(
conditions: Sequence[Mapping[str, Any]], *, task: str
) -> None:
"""Enforce the shared first/last-frame contract after schema validation."""
keyframes = [
condition
for condition in conditions
if condition["role"] == MINIMAX_H3_CONDITION_ROLE_KEYFRAME
]
frame_indices = tuple(condition.get("frame_index") for condition in keyframes)
if frame_indices not in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES:
raise ValueError(
f"conditions for task {task!r} must include one or two ordered "
"image/keyframe entries with frame_index [0], [-1], or [0, -1], "
f"got {list(frame_indices)!r}"
)
if task == MINIMAX_H3_TASK_REF2VA and not any(
condition["role"] == MINIMAX_H3_CONDITION_ROLE_REFERENCE
for condition in conditions
):
raise ValueError(
"ref2va keyframes require at least one reference condition; "
"use task 'fl2va' for keyframe-only generation"
)
def minimax_h3_validate_canonical_request(
*,
task: Any,
prompt: Any,View on GitHub (pinned to 0132848349)
Solutions
- Ensure exactly one or two conditions with role='keyframe' whose frame_index is 0, -1, or the pair [0, -1] in that order
- Add frame_index: 0 (and optionally a second with -1) to keyframe image conditions
- For ref2va also keep at least one reference condition (see companion error)
Example fix
// before
{"role":"keyframe","type":"image","uri":"first.png"}
// after
{"role":"keyframe","type":"image","uri":"first.png","frame_index":0} Defensive patterns
Strategy: validation
Validate before calling
SIGS = {(0,), (-1,), (0, -1)}
def keyframes_ok(conditions):
kf = [c for c in conditions if c.get("role") == "keyframe"]
return tuple(c.get("frame_index") for c in kf) in SIGS Type guard
null
Try / catch
null
Prevention
- Always set frame_index explicitly on keyframe conditions
- Keep keyframe order first=0, last=-1
When it happens
Trigger: Calling minimax_h3_validate_canonical_request for task 'fl2va' or 'ref2va' with zero keyframe conditions, duplicated frame_index (e.g. [0, 0]), wrong order ([-1, 0]), or frame_index set to None on a keyframe-role condition.
Common situations: Omitting frame_index on keyframe images; supplying both keyframes in reversed order; reusing a single image twice; forgetting keyframes entirely and supplying only a reference image.
Related errors
- MiniMax H3 text encoding requires an ordered keyframe signat
- fl2va Qwen preparation requires one or two ordered images wi
- keyframe visual preparation requires one or two ordered imag
- keyframe resolved_frame_index values disagree with semantic
- cached keyframe preparation disagrees with the resolved plan
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/9a48aad10b91a2a7.
Report an issue: GitHub.