{"record":{"id":"2b76418e0c5db1c9","repo":"sgl-project/sglang","slug":"fl2va-qwen-preparation-requires-one-or-two-ordered","errorCode":null,"errorMessage":"fl2va Qwen preparation requires one or two ordered images with a supported semantic_frame_indices signature, got {frame_indices!r}","messagePattern":"fl2va Qwen preparation requires one or two ordered images with a supported semantic_frame_indices signature, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/text_encoding.py","lineNumber":340,"sourceCode":"        *,\n        prompt: str,\n    ) -> dict:\n        from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.canvas import (\n            minimax_h3_prepared_keyframes,\n        )\n        from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.presentation import (\n            minimax_h3_multi_image_presentation,\n        )\n\n        # The SAME prepared target-canvas images feed\n        # Qwen and the visual-condition tokenizer; preparation is cached per request.\n        prepared = minimax_h3_prepared_keyframes(batch, plan)\n        images = [item[\"image\"] for item in prepared[\"images\"]]\n        frame_indices = tuple(prepared.get(\"semantic_frame_indices\") or ())\n        if frame_indices not in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES or len(\n            images\n        ) != len(frame_indices):\n            raise ValueError(\n                \"fl2va Qwen preparation requires one or two ordered images with \"\n                \"a supported semantic_frame_indices signature, got \"\n                f\"{frame_indices!r}\"\n            )\n        processor = self.processor\n        vision = processor.image_processor(images=images, return_tensors=\"pt\")\n        pixel_values = vision[\"pixel_values\"]\n        image_grid_thw = vision[\"image_grid_thw\"]\n        if int(image_grid_thw.shape[0]) != len(images):\n            raise ValueError(\n                f\"expected {len(images)} image grids, got {list(image_grid_thw.shape)}\"\n            )\n        merge = int(processor.image_processor.merge_size) ** 2\n        image_token_counts = [\n            int(image_grid_thw[i].prod().item()) // merge for i in range(len(images))\n        ]\n        pos_ids, pos_tags = minimax_h3_multi_image_presentation(\n            self.tokenizer,","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/text_encoding.py#L322-L358","documentation":"For fl2va keyframe encoding, prepared['semantic_frame_indices'] must be one of the supported signatures AND the number of prepared images must equal len(frame_indices). This ValueError catches malformed keyframe preparation — mismatched image/index counts or unsupported index tuples.","triggerScenarios":"_encode_fl2va_keyframes gets a prepared dict where semantic_frame_indices is empty/unsupported, or images length differs from the indices length (e.g. 2 images with one index, or indices () with 1 image).","commonSituations":"minimax_h3_prepared_keyframes returning inconsistent structures for edge-case requests (single image with no indices), upstream preparation bugs, or hand-built prepared dicts in tests.","solutions":["Ensure the request's keyframes produce a supported signature (e.g. (0,) or (0, last)) with exactly matching image count","Check the output of minimax_h3_prepared_keyframes for the failing request and fix index propagation upstream","Rebuild the request through the canonical fl2va request builder"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"prepared = minimax_h3_prepared_keyframes(batch, plan)\nidx = tuple(prepared.get(\"semantic_frame_indices\") or ())\nassert idx in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES and len(prepared[\"images\"]) == len(idx), idx","typeGuard":"def prepared_keyframes_valid(prepared) -> bool:\n    idx = tuple(prepared.get(\"semantic_frame_indices\") or ())\n    return idx in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES and len(prepared[\"images\"]) == len(idx)","tryCatchPattern":null,"preventionTips":["Send exactly one or two ordered keyframes for fl2va","Unit-test minimax_h3_prepared_keyframes output shape/indices consistency"],"tags":["minimax-h3","fl2va","keyframes","validation"],"backgroundTag":"payload-schema-validation","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}