sgl-project/sglang · error · RuntimeError

ffprobe returned invalid stream metadata

Error message

ffprobe returned invalid stream metadata

What it means

After parsing the ffprobe JSON payload, the 'streams' key must be a list. If it is missing, None, or another type, stream metadata is malformed and the adapter raises RuntimeError instead of iterating it.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/video_adapter.py:407

        ) from exc
    except subprocess.CalledProcessError as exc:
        detail = (exc.stderr or "").strip()
        suffix = f": {detail}" if detail else ""
        raise RuntimeError(
            f"ffprobe failed for final MiniMax H3 output{suffix}"
        ) from exc

    try:
        payload = json.loads(probe.stdout)
    except (TypeError, ValueError) as exc:
        raise RuntimeError(
            "ffprobe returned invalid JSON for MiniMax H3 output"
        ) from exc
    if not isinstance(payload, dict):
        raise RuntimeError("ffprobe returned invalid JSON for MiniMax H3 output")
    streams = payload.get("streams") or []
    if not isinstance(streams, list):
        raise RuntimeError("ffprobe returned invalid stream metadata")
    video_streams = [
        stream
        for stream in streams
        if isinstance(stream, dict) and stream.get("codec_type") == "video"
    ]
    audio_streams = [
        stream
        for stream in streams
        if isinstance(stream, dict) and stream.get("codec_type") == "audio"
    ]
    if len(streams) != 2 or len(video_streams) != 1 or len(audio_streams) != 1:
        raise RuntimeError(
            "generated MiniMax H3 MP4 must contain exactly one video stream and "
            f"one audio stream, got {len(video_streams)} video, "
            f"{len(audio_streams)} audio, and {len(streams)} total streams"
        )
    video_stream = video_streams[0]
    audio_stream = audio_streams[0]

View on GitHub (pinned to 0132848349)

Solutions

  1. Verify the probed file is a real MP4 (file command, ffprobe manually)
  2. Use a current standard ffmpeg/ffprobe build
  3. Re-run generation if the output file was truncated/empty
Defensive patterns

Strategy: validation

Validate before calling

payload = json.loads(ffprobe_stdout)
assert isinstance(payload.get("streams"), list) and payload["streams"]

Type guard

def has_streams(payload: dict) -> bool:
    return isinstance(payload.get("streams"), list)

Prevention

When it happens

Trigger: ffprobe JSON payload where payload['streams'] is absent or not a list (e.g. probing a non-media file that yields an empty/odd payload, or a wrapper altering output).

Common situations: Output path pointing to a text/empty file; altered ffprobe output formats; older ffprobe versions with different key behavior.

Related errors


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