sgl-project/sglang · error · ValueError

MiniMax H3 media material has no positive duration

Error message

MiniMax H3 media material has no positive duration

What it means

No positive, finite duration could be found from the container format.duration or any stream duration. Every candidate was missing, zero/negative, or NaN/inf. The pipeline needs a duration for scheduling and truncation.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py:472

            raise ValueError("MiniMax H3 audio material has no usable sample rate")
        if channels <= 0:
            raise ValueError("MiniMax H3 audio material has no usable channel count")

    durations: list[float] = []
    for value in [
        (payload.get("format") or {}).get("duration"),
        *(stream.get("duration") for stream in streams),
    ]:
        if value in {None, "", "N/A"}:
            continue
        try:
            duration = float(value)
        except (TypeError, ValueError):
            continue
        if math.isfinite(duration) and duration > 0:
            durations.append(duration)
    if not durations:
        raise ValueError("MiniMax H3 media material has no positive duration")

    duration_seconds = max(durations)
    facts: dict[str, Any] = {
        "condition_type": condition_type,
        "duration_seconds": duration_seconds,
        "has_audio": bool(audio_streams),
    }
    if primary_video is not None:
        coded_width = int(primary_video.get("width") or 0)
        coded_height = int(primary_video.get("height") or 0)
        display_width, display_height, sar, rotation = _display_geometry(primary_video)
        fps = _parse_frame_rate(primary_video.get("avg_frame_rate"))
        if fps <= 0:
            fps = _parse_frame_rate(primary_video.get("r_frame_rate"))
        raw_count = primary_video.get("nb_frames")
        try:
            frame_count = int(raw_count)
        except (TypeError, ValueError):

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-mux to force duration metadata: ffmpeg -i in.webm -c copy out.mp4
  2. Fully finalize/finish writing the media before submitting (no growing files)
  3. For live captures, record with a proper container (mp4/mkv) so duration is indexed
Defensive patterns

Strategy: validation

Validate before calling

dur = float(json.loads(subprocess.check_output(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "json", path]))["format"].get("duration") or 0)
assert dur > 0

Prevention

When it happens

Trigger: Media files where ffprobe reports no duration at all (live streams, some raw streams, growing files) or only 0/N/A durations.

Common situations: Concatenated or streamed captures without seek indexes, files still being written, or raw streams (.aac, .h264 elementary).

Related errors


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