{"record":{"id":"5a28c6dee1e68470","repo":"sgl-project/sglang","slug":"generated-minimax-h3-mp4-size-does-not-match-the-r","errorCode":null,"errorMessage":"generated MiniMax H3 MP4 size does not match the resolved request: expected {expected_size[0]}x{expected_size[1]}, got {width}x{height}","messagePattern":"generated MiniMax H3 MP4 size does not match the resolved request: expected (.+?)x(.+?), got (.+?)x(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/video_adapter.py","lineNumber":433,"sourceCode":"        for stream in streams\n        if isinstance(stream, dict) and stream.get(\"codec_type\") == \"audio\"\n    ]\n    if len(streams) != 2 or len(video_streams) != 1 or len(audio_streams) != 1:\n        raise RuntimeError(\n            \"generated MiniMax H3 MP4 must contain exactly one video stream and \"\n            f\"one audio stream, got {len(video_streams)} video, \"\n            f\"{len(audio_streams)} audio, and {len(streams)} total streams\"\n        )\n    video_stream = video_streams[0]\n    audio_stream = audio_streams[0]\n    width = int(video_stream.get(\"width\") or 0)\n    height = int(video_stream.get(\"height\") or 0)\n    if width <= 0 or height <= 0:\n        raise RuntimeError(\n            f\"generated MiniMax H3 MP4 has invalid size {width}x{height}\"\n        )\n    if expected_size is not None and (width, height) != expected_size:\n        raise RuntimeError(\n            \"generated MiniMax H3 MP4 size does not match the resolved request: \"\n            f\"expected {expected_size[0]}x{expected_size[1]}, got {width}x{height}\"\n        )\n    rate_raw = str(video_stream.get(\"avg_frame_rate\") or \"\")\n    try:\n        if \"/\" in rate_raw:\n            numerator, denominator = rate_raw.split(\"/\", 1)\n            fps = float(numerator) / float(denominator)\n        else:\n            fps = float(rate_raw)\n    except (TypeError, ValueError, ZeroDivisionError):\n        fps = 0.0\n    if abs(fps - float(MINIMAX_H3_SUPPORTED_FPS)) > 1e-6:\n        raise RuntimeError(\n            \"generated MiniMax H3 MP4 frame rate must be \"\n            f\"{MINIMAX_H3_SUPPORTED_FPS} fps, got {rate_raw!r}\"\n        )\n    try:","sourceCodeStart":415,"sourceCodeEnd":451,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/video_adapter.py#L415-L451","documentation":"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.","triggerScenarios":"_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.","commonSituations":"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.","solutions":["Use resolutions from MiniMax H3's supported ladder (e.g. 768p/1080p canonical sizes) so quantization matches exactly","Check whether width/height are swapped for portrait orientation and adjust the request","Log both expected and actual sizes; if the model silently changes canvas, report as a bug","Retry with explicit width/height rather than a shorthand resolution"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"expected = adapter._resolved_shape(batch)  # or your resolved (w,h)\nw,h = probe_size(paths[0])\nassert (w,h)==expected, f\"got {w}x{h}, expected {expected}\"","typeGuard":null,"tryCatchPattern":"try:\n    fields = adapter.validate_final_outputs_sync(paths, batch)\nexcept RuntimeError as e:\n    if \"does not match the resolved request\" in str(e):\n        accept_or_crop_to_requested_size(paths[0], expected)  # post-process\n    else:\n        raise","preventionTips":["Use canonical resolutions from the model's supported ladder","Pass explicit width/height for portrait requests to avoid swap/quantization surprises"],"tags":["minimax-h3","resolution","geometry-mismatch","validation"],"backgroundTag":"output-resolution-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}