{"record":{"id":"b0279a42545b54d1","repo":"sgl-project/sglang","slug":"error-processing-video-at-index-idx-e","errorCode":null,"errorMessage":"Error processing video at index {idx}: {e}","messagePattern":"Error processing video at index (.+?): (.+?)","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/mimo_v2.py","lineNumber":859,"sourceCode":"                video_contents_info.append((idx, content.content))\n\n        video_results = {}\n        if not video_contents_info:\n            return video_results\n\n        num_threads = min(self.video_process_num_threads, len(video_contents_info))\n        if num_threads > 1 and len(video_contents_info) > 1:\n            with ThreadPoolExecutor(max_workers=num_threads) as executor:\n                future_to_idx = {\n                    executor.submit(self.process_video, video_input): idx\n                    for idx, video_input in video_contents_info\n                }\n                for future in as_completed(future_to_idx):\n                    idx = future_to_idx[future]\n                    try:\n                        video_results[idx] = future.result()\n                    except Exception as e:\n                        raise RuntimeError(\n                            f\"Error processing video at index {idx}: {e}\"\n                        ) from e\n        else:\n            for idx, video_input in video_contents_info:\n                video_results[idx] = self.process_video(video_input)\n        return video_results\n\n    def _process_text_content(self, content, verbose):\n        if isinstance(content.content, str):\n            _input_ids = self.tokenizer.encode(content.content)\n        else:\n            _input_ids = content.content\n        _labels = _input_ids if content.is_target else None\n\n        verbose_str = \"\"\n        if verbose:\n            if isinstance(content.content, str):\n                verbose_str = f\"Text: [{content.content}]\\n\"","sourceCodeStart":841,"sourceCodeEnd":877,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/mimo_v2.py#L841-L877","documentation":"A wrapper exception raised in _process_videos_parallel when one of the worker futures executing process_video fails. The original exception is chained (__cause__), and the message reports the index of the offending video in the request's video list.","triggerScenarios":"Sending a batch request containing multiple videos where any one video fails inside process_video — decode failure, unsupported type (5781/5785), missing sampling config (5783), or segment selection failure (5784) — while the executor path (as_completed) is in use.","commonSituations":"Batch requests mixing one corrupt/unsupported video with good ones; a single oversized or zero-frame video poisoning the whole batch; the underlying cause listed in the chained message is the real problem to fix.","solutions":["Inspect the chained cause ({e} in the message) — fix the underlying process_video failure for that index","Split the request to identify/isolate the failing video, or remove it","Pre-validate each video (playable, supported format, decodes with load_video) before batching"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    results = proc._process_videos_parallel(items)\nexcept RuntimeError as e:\n    m = re.search(r'index (\\d+)', str(e))\n    if m and e.__cause__:\n        bad = int(m.group(1))\n        results = proc._process_videos_parallel(items[:bad] + items[bad+1:])  # drop bad, or handle\n    else:\n        raise","preventionTips":["Pre-validate every video in a batch (decodes cleanly) before sending","Send small batches so one bad video doesn't kill the request","Always inspect e.__cause__ — the index message is only a wrapper"],"tags":["video","parallel","executor","error-chaining","batch"],"backgroundTag":"parallel-task-failure","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}