sgl-project/sglang · error · RuntimeError

Error processing video at index {idx}: {e}

Error message

Error processing video at index {idx}: {e}

What it means

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.

Source

Thrown at python/sglang/srt/multimodal/processors/mimo_v2.py:859

                video_contents_info.append((idx, content.content))

        video_results = {}
        if not video_contents_info:
            return video_results

        num_threads = min(self.video_process_num_threads, len(video_contents_info))
        if num_threads > 1 and len(video_contents_info) > 1:
            with ThreadPoolExecutor(max_workers=num_threads) as executor:
                future_to_idx = {
                    executor.submit(self.process_video, video_input): idx
                    for idx, video_input in video_contents_info
                }
                for future in as_completed(future_to_idx):
                    idx = future_to_idx[future]
                    try:
                        video_results[idx] = future.result()
                    except Exception as e:
                        raise RuntimeError(
                            f"Error processing video at index {idx}: {e}"
                        ) from e
        else:
            for idx, video_input in video_contents_info:
                video_results[idx] = self.process_video(video_input)
        return video_results

    def _process_text_content(self, content, verbose):
        if isinstance(content.content, str):
            _input_ids = self.tokenizer.encode(content.content)
        else:
            _input_ids = content.content
        _labels = _input_ids if content.is_target else None

        verbose_str = ""
        if verbose:
            if isinstance(content.content, str):
                verbose_str = f"Text: [{content.content}]\n"

View on GitHub (pinned to 0132848349)

Solutions

  1. Inspect the chained cause ({e} in the message) — fix the underlying process_video failure for that index
  2. Split the request to identify/isolate the failing video, or remove it
  3. Pre-validate each video (playable, supported format, decodes with load_video) before batching
Defensive patterns

Strategy: try-catch

Try / catch

try:
    results = proc._process_videos_parallel(items)
except RuntimeError as e:
    m = re.search(r'index (\d+)', str(e))
    if m and e.__cause__:
        bad = int(m.group(1))
        results = proc._process_videos_parallel(items[:bad] + items[bad+1:])  # drop bad, or handle
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/b0279a42545b54d1. Report an issue: GitHub.