{"record":{"id":"9a48aad10b91a2a7","repo":"sgl-project/sglang","slug":"conditions-for-task-task-r-must-include-one-or-t","errorCode":null,"errorMessage":"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}","messagePattern":"conditions for task (.+?) must include one or two ordered image/keyframe entries with frame_index \\[0\\], \\[-1\\], or \\[0, -1\\], got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py","lineNumber":263,"sourceCode":"                )\n            entry[\"start_time_seconds\"] = start_time_seconds\n        normalized.append(entry)\n    return normalized\n\n\ndef _validate_keyframe_conditions(\n    conditions: Sequence[Mapping[str, Any]], *, task: str\n) -> None:\n    \"\"\"Enforce the shared first/last-frame contract after schema validation.\"\"\"\n\n    keyframes = [\n        condition\n        for condition in conditions\n        if condition[\"role\"] == MINIMAX_H3_CONDITION_ROLE_KEYFRAME\n    ]\n    frame_indices = tuple(condition.get(\"frame_index\") for condition in keyframes)\n    if frame_indices not in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES:\n        raise ValueError(\n            f\"conditions for task {task!r} must include one or two ordered \"\n            \"image/keyframe entries with frame_index [0], [-1], or [0, -1], \"\n            f\"got {list(frame_indices)!r}\"\n        )\n    if task == MINIMAX_H3_TASK_REF2VA and not any(\n        condition[\"role\"] == MINIMAX_H3_CONDITION_ROLE_REFERENCE\n        for condition in conditions\n    ):\n        raise ValueError(\n            \"ref2va keyframes require at least one reference condition; \"\n            \"use task 'fl2va' for keyframe-only generation\"\n        )\n\n\ndef minimax_h3_validate_canonical_request(\n    *,\n    task: Any,\n    prompt: Any,","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py#L245-L281","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":"// before\n{\"role\":\"keyframe\",\"type\":\"image\",\"uri\":\"first.png\"}\n// after\n{\"role\":\"keyframe\",\"type\":\"image\",\"uri\":\"first.png\",\"frame_index\":0}","handlingStrategy":"validation","validationCode":"SIGS = {(0,), (-1,), (0, -1)}\ndef keyframes_ok(conditions):\n    kf = [c for c in conditions if c.get(\"role\") == \"keyframe\"]\n    return tuple(c.get(\"frame_index\") for c in kf) in SIGS","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Always set frame_index explicitly on keyframe conditions","Keep keyframe order first=0, last=-1"],"tags":["minimax-h3","keyframes","fl2va","ref2va","request-validation"],"backgroundTag":"request-schema-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}