{"record":{"id":"be879c21c5d95363","repo":"sgl-project/sglang","slug":"cpath-frame-index-requires-a-resolved-target-dur","errorCode":null,"errorMessage":"{cpath}.frame_index requires a resolved target duration","messagePattern":"(.+?)\\.frame_index requires a resolved target duration","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":212,"sourceCode":"        if role not in (\n            MINIMAX_H3_CONDITION_ROLE_KEYFRAME,\n            MINIMAX_H3_CONDITION_ROLE_REFERENCE,\n        ):\n            raise ValueError(\n                f\"{cpath}.role must be keyframe or reference, \" f\"got {role!r}\"\n            )\n        cond_type = _require_str(cond.get(\"type\"), f\"{cpath}.type\")\n        try:\n            rule = profile.rule_for(role=role, condition_type=cond_type)\n        except ValueError as exc:\n            raise ValueError(f\"{cpath}: {exc}\") from exc\n        uri = _require_str(cond.get(\"uri\"), f\"{cpath}.uri\")\n\n        entry: dict[str, Any] = {\"type\": cond_type, \"uri\": uri, \"role\": role}\n        if rule.requires_frame_index:\n            frame_index = _require_int(cond.get(\"frame_index\"), f\"{cpath}.frame_index\")\n            if aligned_frame_count is None:\n                raise ValueError(\n                    f\"{cpath}.frame_index requires a resolved target duration\"\n                )\n            if frame_index == -1:\n                resolved = aligned_frame_count - 1\n            elif 0 <= frame_index < aligned_frame_count:\n                resolved = frame_index\n            else:\n                raise ValueError(\n                    f\"{cpath}.frame_index must be -1 or in \"\n                    f\"[0, {aligned_frame_count}) after 17n+5 frame alignment, \"\n                    f\"got {frame_index}\"\n                )\n            if resolved in seen_frame_indices:\n                raise ValueError(\n                    f\"{cpath}.frame_index resolves to {resolved}, already \"\n                    f\"bound by conditions[{seen_frame_indices[resolved]}]\"\n                )\n            seen_frame_indices[resolved] = index","sourceCodeStart":194,"sourceCodeEnd":230,"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#L194-L230","documentation":"A condition whose rule requires frame_index was validated, but no target duration was resolved, so the frame count (via minimax_h3_align_frame_count) is unknown and frame_index cannot be bounds-checked.","triggerScenarios":"Keyframe condition with frame_index set while target.duration_seconds is absent and the task can't derive duration from audio.","commonSituations":"Omitting duration on keyframe-driven requests; audio reference missing so duration derivation fails silently until this point.","solutions":["Add target.duration_seconds so the frame count can be computed","Or attach the audio reference the profile uses to derive duration"],"exampleFix":"// before\n{\"target\": {\"short_edge\": 768, \"aspect_ratio\": \"auto\"}, \"conditions\": [{..., \"frame_index\": 0}]}\n// after\n{\"target\": {\"short_edge\": 768, \"aspect_ratio\": \"auto\", \"duration_seconds\": 6}, \"conditions\": [{..., \"frame_index\": 0}]}","handlingStrategy":"validation","validationCode":"needs_fi = any(c.get('frame_index') is not None for c in conditions)\nif needs_fi and 'duration_seconds' not in target and not profile.duration_from_audio_reference:\n    raise ValueError('set duration_seconds before using frame_index')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set duration when keyframes are addressed by frame"],"tags":["minimax-h3","frame-index","duration","dependency-order"],"backgroundTag":"missing-required-field","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}