sgl-project/sglang · error · ValueError

MiniMax H3 video material has invalid dimensions

Error message

MiniMax H3 video material has invalid dimensions

What it means

A video stream's width/height fields could not be parsed as integers (TypeError/ValueError from int() on the ffprobe values). The stream metadata is malformed.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py:434

        "flac",
        "ogg",
    }
    if not format_names or not format_names.issubset(allowed_formats):
        raise ValueError("MiniMax H3 media container format is not allowed")
    video_streams = [s for s in streams if s.get("codec_type") == "video"]
    audio_streams = [s for s in streams if s.get("codec_type") == "audio"]
    if condition_type in {"video", "video_audio"} and not video_streams:
        raise ValueError("MiniMax H3 video material has no video stream")
    if condition_type in {"audio", "video_audio"} and not audio_streams:
        raise ValueError("MiniMax H3 audio material has no audio stream")

    primary_video: dict[str, Any] | None = None
    for stream in video_streams:
        try:
            width = int(stream.get("width") or 0)
            height = int(stream.get("height") or 0)
        except (TypeError, ValueError) as exc:
            raise ValueError(
                "MiniMax H3 video material has invalid dimensions"
            ) from exc
        if width <= 0 or height <= 0:
            raise ValueError("MiniMax H3 video material has no positive dimensions")
        fps = _parse_frame_rate(stream.get("avg_frame_rate")) or _parse_frame_rate(
            stream.get("r_frame_rate")
        )
        if fps <= 0:
            raise ValueError("MiniMax H3 video material has no usable frame rate")
        if primary_video is None:
            primary_video = stream

    for stream in audio_streams:
        try:
            sample_rate = int(stream.get("sample_rate") or 0)
            channels = int(stream.get("channels") or 0)
        except (TypeError, ValueError) as exc:
            raise ValueError("MiniMax H3 audio material has invalid metadata") from exc

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-mux/re-encode the file with ffmpeg to force dimension metadata: ffmpeg -i in.mkv -c:v libx264 out.mp4
  2. Inspect ffprobe -show_streams -of json output for the offending stream
  3. Drop or replace the problematic material
Defensive patterns

Strategy: validation

Validate before calling

for s in video_streams:
    try:
        assert int(s["width"]) > 0 and int(s["height"]) > 0
    except (KeyError, TypeError, ValueError):
        raise BadMaterial(path)

Prevention

When it happens

Trigger: ffprobe returns a video stream whose 'width'/'height' keys hold non-numeric strings or None-like values that int() rejects.

Common situations: Exotic/corrupt containers where ffprobe emits partial metadata; streams with unset dimensions (some raw/coded streams).

Related errors


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