{"record":{"id":"ee823f12f2c429bc","repo":"sgl-project/sglang","slug":"pixel-values-videos-and-video-grid-thw-must-be-giv","errorCode":null,"errorMessage":"pixel_values_videos and video_grid_thw must be given together","messagePattern":"pixel_values_videos and video_grid_thw must be given together","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/encoders/minimax_h3_qwen3vl.py","lineNumber":343,"sourceCode":"        )\n        return BaseEncoderOutput(last_hidden_state=outputs.last_hidden_state)\n\n    @torch.no_grad()\n    def encode_ids(\n        self,\n        input_ids: torch.Tensor,\n        *,\n        pixel_values: torch.Tensor | None = None,\n        image_grid_thw: torch.Tensor | None = None,\n        pixel_values_videos: torch.Tensor | None = None,\n        video_grid_thw: torch.Tensor | None = None,\n    ) -> torch.Tensor:\n        if input_ids.dim() != 1:\n            raise ValueError(f\"input_ids must be 1-D, got {list(input_ids.shape)}\")\n        if (pixel_values is None) != (image_grid_thw is None):\n            raise ValueError(\"pixel_values and image_grid_thw must be given together\")\n        if (pixel_values_videos is None) != (video_grid_thw is None):\n            raise ValueError(\n                \"pixel_values_videos and video_grid_thw must be given together\"\n            )\n\n        host_ids = input_ids.to(device=\"cpu\", dtype=torch.long)[None]\n        host_image_grid_thw = (\n            image_grid_thw.to(device=\"cpu\", dtype=torch.long)\n            if image_grid_thw is not None\n            else None\n        )\n        host_video_grid_thw = (\n            video_grid_thw.to(device=\"cpu\", dtype=torch.long)\n            if video_grid_thw is not None\n            else None\n        )\n        position_ids = None\n        if host_image_grid_thw is not None or host_video_grid_thw is not None:\n            position_ids, _ = self.model.get_rope_index(\n                host_ids,","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/encoders/minimax_h3_qwen3vl.py#L325-L361","documentation":"Same pairing rule as images but for video: pixel_values_videos and video_grid_thw must be given together or both omitted. Video patch interpretation needs the grid tensor.","triggerScenarios":"encode_ids(..., pixel_values_videos=v) without video_grid_thw, or vice versa.","commonSituations":"Video-only or mixed image/video call sites where one of the two processor outputs was dropped during refactoring.","solutions":["Pass video_grid_thw together with pixel_values_videos from the processor output","Omit both when the sequence has no video"],"exampleFix":"# before\nhidden = enc.encode_ids(ids, pixel_values_videos=pvv)\n# after\nhidden = enc.encode_ids(ids, pixel_values_videos=pvv, video_grid_thw=video_thw)","handlingStrategy":"validation","validationCode":"assert (pixel_values_videos is None) == (video_grid_thw is None)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass processor outputs wholesale rather than cherry-picking tensors","Cover video paths in unit tests to catch dropped grid tensors"],"tags":["minimax-h3","encode-ids","paired-args","video-input"],"backgroundTag":"missing-required-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}