sgl-project/sglang · error · RuntimeError

ffprobe returned invalid JSON for MiniMax H3 output

Error message

ffprobe returned invalid JSON for MiniMax H3 output

What it means

After ffprobe succeeds, its stdout is parsed as JSON (ffprobe -show_streams -of json style). If json.loads raises TypeError/ValueError, the output is not parseable JSON — typically because ffprobe printed warnings/banners to stdout or an unexpected format was requested. The adapter cannot extract stream metadata, so it raises RuntimeError.

Source

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

    except subprocess.TimeoutExpired as exc:
        raise RuntimeError(
            "MiniMax H3 final output ffprobe timed out after 30 seconds"
        ) from exc
    except FileNotFoundError as exc:
        raise RuntimeError(
            "ffprobe is required to validate final MiniMax H3 output"
        ) 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:

View on GitHub (pinned to 0132848349)

Solutions

  1. Run the same ffprobe command manually and inspect raw stdout
  2. Upgrade/normalize the ffmpeg installation (use a standard distro build)
  3. Pin output_path to local storage to avoid interleaved FS warnings
Defensive patterns

Strategy: fallback

Try / catch

try:
    fields = adapter.validate_final_outputs_sync(paths, batch)
except RuntimeError as e:
    if "invalid JSON" in str(e):
        fields = manual_ffprobe_json(paths[0])  # parse ffprobe yourself
    else:
        raise

Prevention

When it happens

Trigger: ffprobe stdout containing non-JSON noise (version banners, warnings) or truncated output, causing json.loads to fail.

Common situations: Exotic ffprobe builds/versions with different JSON output behavior; locale/env forcing extra output; stdout interleaved with warnings.

Understand the failure class

Background: "Invalid JSON response" and "Failed to parse response" errors: when an API answers 200 but the body isn't the JSON your library expected — this error's family across 28 libraries.

Related errors


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