sgl-project/sglang · error · RuntimeError

generated MiniMax H3 MP4 size does not match the resolved re

Error message

generated MiniMax H3 MP4 size does not match the resolved request: expected {expected_size[0]}x{expected_size[1]}, got {width}x{height}

What it means

When the request carried a resolved expected size (from the pre-queue resolved_v2 geometry), the adapter checks the generated MP4's (width, height) against it. A mismatch means the model produced a different canvas than requested (e.g. aspect-ratio snapping or a resolution-resolution bug) and the output violates the delivery contract.

Source

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

        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]
    width = int(video_stream.get("width") or 0)
    height = int(video_stream.get("height") or 0)
    if width <= 0 or height <= 0:
        raise RuntimeError(
            f"generated MiniMax H3 MP4 has invalid size {width}x{height}"
        )
    if expected_size is not None and (width, height) != expected_size:
        raise RuntimeError(
            "generated MiniMax H3 MP4 size does not match the resolved request: "
            f"expected {expected_size[0]}x{expected_size[1]}, got {width}x{height}"
        )
    rate_raw = str(video_stream.get("avg_frame_rate") or "")
    try:
        if "/" in rate_raw:
            numerator, denominator = rate_raw.split("/", 1)
            fps = float(numerator) / float(denominator)
        else:
            fps = float(rate_raw)
    except (TypeError, ValueError, ZeroDivisionError):
        fps = 0.0
    if abs(fps - float(MINIMAX_H3_SUPPORTED_FPS)) > 1e-6:
        raise RuntimeError(
            "generated MiniMax H3 MP4 frame rate must be "
            f"{MINIMAX_H3_SUPPORTED_FPS} fps, got {rate_raw!r}"
        )
    try:

View on GitHub (pinned to 0132848349)

Solutions

  1. Use resolutions from MiniMax H3's supported ladder (e.g. 768p/1080p canonical sizes) so quantization matches exactly
  2. Check whether width/height are swapped for portrait orientation and adjust the request
  3. Log both expected and actual sizes; if the model silently changes canvas, report as a bug
  4. Retry with explicit width/height rather than a shorthand resolution
Defensive patterns

Strategy: validation

Validate before calling

expected = adapter._resolved_shape(batch)  # or your resolved (w,h)
w,h = probe_size(paths[0])
assert (w,h)==expected, f"got {w}x{h}, expected {expected}"

Try / catch

try:
    fields = adapter.validate_final_outputs_sync(paths, batch)
except RuntimeError as e:
    if "does not match the resolved request" in str(e):
        accept_or_crop_to_requested_size(paths[0], expected)  # post-process
    else:
        raise

Prevention

When it happens

Trigger: _probe_minimax_h3_output_fields runs with expected_size set and ffprobe reports a different (width, height) — e.g. requested 1280x720 but got 720x1280 or 960x544.

Common situations: Aspect ratio quantization in the model not matching requested resolutions; transposed width/height for portrait videos; geometry resolution bugs; unusual resolutions not in the model's supported ladder.

Related errors


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