sgl-project/sglang · error · ValueError

MiniMax H3 audio material has invalid metadata

Error message

MiniMax H3 audio material has invalid metadata

What it means

An audio stream's sample_rate or channels fields could not be converted to int — the ffprobe metadata is malformed for that stream.

Source

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

            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
        if sample_rate <= 0:
            raise ValueError("MiniMax H3 audio material has no usable sample rate")
        if channels <= 0:
            raise ValueError("MiniMax H3 audio material has no usable channel count")

    durations: list[float] = []
    for value in [
        (payload.get("format") or {}).get("duration"),
        *(stream.get("duration") for stream in streams),
    ]:
        if value in {None, "", "N/A"}:
            continue
        try:
            duration = float(value)
        except (TypeError, ValueError):
            continue
        if math.isfinite(duration) and duration > 0:
            durations.append(duration)

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-encode the audio: ffmpeg -i in.mp4 -c:a aac -ar 44100 -ac 2 out.mp4
  2. Inspect ffprobe -show_streams JSON for the offending audio stream
  3. Drop the broken material or replace its source
Defensive patterns

Strategy: validation

Validate before calling

for s in audio_streams:
    int(s["sample_rate"]); int(s["channels"])  # KeyError/TypeError = bad metadata

Prevention

When it happens

Trigger: ffprobe returns an audio stream whose sample_rate/channels are non-numeric (None or garbage), making int() raise TypeError/ValueError.

Common situations: Partially corrupt audio tracks, streams from unusual containers, or high-channel layouts where ffprobe emits unexpected field formats.

Related errors


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