{"record":{"id":"a8cb8a74c9be7e0b","repo":"sgl-project/sglang","slug":"ffprobe-returned-invalid-stream-metadata","errorCode":null,"errorMessage":"ffprobe returned invalid stream metadata","messagePattern":"ffprobe returned invalid stream metadata","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":407,"sourceCode":"        ) from exc\n    except subprocess.CalledProcessError as exc:\n        detail = (exc.stderr or \"\").strip()\n        suffix = f\": {detail}\" if detail else \"\"\n        raise RuntimeError(\n            f\"ffprobe failed for final MiniMax H3 output{suffix}\"\n        ) from exc\n\n    try:\n        payload = json.loads(probe.stdout)\n    except (TypeError, ValueError) as exc:\n        raise RuntimeError(\n            \"ffprobe returned invalid JSON for MiniMax H3 output\"\n        ) from exc\n    if not isinstance(payload, dict):\n        raise RuntimeError(\"ffprobe returned invalid JSON for MiniMax H3 output\")\n    streams = payload.get(\"streams\") or []\n    if not isinstance(streams, list):\n        raise RuntimeError(\"ffprobe returned invalid stream metadata\")\n    video_streams = [\n        stream\n        for stream in streams\n        if isinstance(stream, dict) and stream.get(\"codec_type\") == \"video\"\n    ]\n    audio_streams = [\n        stream\n        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]","sourceCodeStart":389,"sourceCodeEnd":425,"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#L389-L425","documentation":"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.","triggerScenarios":"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).","commonSituations":"Output path pointing to a text/empty file; altered ffprobe output formats; older ffprobe versions with different key behavior.","solutions":["Verify the probed file is a real MP4 (file command, ffprobe manually)","Use a current standard ffmpeg/ffprobe build","Re-run generation if the output file was truncated/empty"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"payload = json.loads(ffprobe_stdout)\nassert isinstance(payload.get(\"streams\"), list) and payload[\"streams\"]","typeGuard":"def has_streams(payload: dict) -> bool:\n    return isinstance(payload.get(\"streams\"), list)","tryCatchPattern":null,"preventionTips":["Check output files are non-empty MP4s before validation","Keep one validated ffprobe invocation helper across your codebase"],"tags":["minimax-h3","ffprobe","stream-metadata","validation"],"backgroundTag":"media-file-corrupt","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}