sgl-project/sglang · error · ValueError

{path}.duration_seconds must be positive

Error message

{path}.duration_seconds must be positive

What it means

duration_seconds is a number but <= 0. Durations must be positive; 0 or negative values usually indicate a sign error or an unset default like -1.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py:126

            f"{path}.aspect_ratio for task {profile.task!r} must be 'auto' or "
            f"one of {list(MINIMAX_H3_FINITE_ASPECT_RATIOS)!r}, got "
            f"{aspect_ratio!r}"
        )
    if not has_duration:
        if not profile.duration_from_audio_reference:
            raise ValueError(f"{path}.duration_seconds is required")
        # ref2va: duration may derive from a reference audio; the
        # audio-condition presence is enforced after conditions validate.
    out: dict[str, Any] = {
        "short_edge": short_edge,
        "aspect_ratio": aspect_ratio,
    }
    if has_duration:
        duration = target["duration_seconds"]
        if isinstance(duration, bool) or not isinstance(duration, (int, float)):
            raise ValueError(f"{path}.duration_seconds must be a number")
        if duration <= 0:
            raise ValueError(f"{path}.duration_seconds must be positive")
        if not (
            MINIMAX_H3_MIN_DURATION_SECONDS
            <= float(duration)
            <= MINIMAX_H3_MAX_DURATION_SECONDS
        ):
            raise ValueError(
                f"{path}.duration_seconds must be in "
                f"[{MINIMAX_H3_MIN_DURATION_SECONDS:g}, "
                f"{MINIMAX_H3_MAX_DURATION_SECONDS:g}], got {duration}"
            )
        out["duration_seconds"] = float(duration)
    return out


def _validate_conditions(
    conditions: Any,
    *,
    profile: MiniMaxH3TaskProfile,

View on GitHub (pinned to 0132848349)

Solutions

  1. Use a positive duration within [MIN,MAX] bounds
  2. Replace sentinel values (-1/0) with omission of the key or a real duration

Example fix

// before
{"duration_seconds": 0}
// after
{"duration_seconds": 6}
Defensive patterns

Strategy: validation

Validate before calling

if target.get('duration_seconds', 0) <= 0:
    raise ValueError('duration_seconds must be > 0')

Prevention

When it happens

Trigger: Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py:126 when the library encounters an invalid state.

Common situations: Using -1 or 0 as 'not set' sentinel; computing duration as end-start with reversed timestamps.

Related errors


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