sgl-project/sglang · error · ValueError

{path}.duration_seconds must be in [{MINIMAX_H3_MIN_DURATION

Error message

{path}.duration_seconds must be in [{MINIMAX_H3_MIN_DURATION_SECONDS:g}, {MINIMAX_H3_MAX_DURATION_SECONDS:g}], got {duration}

What it means

duration_seconds is outside [MINIMAX_H3_MIN_DURATION_SECONDS, MINIMAX_H3_MAX_DURATION_SECONDS]. The pipeline only supports this bounded range; the message embeds the exact bounds with %g formatting.

Source

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

            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,
    frame_count: int | None,
) -> list[dict[str, Any]]:
    path = "conditions"
    if conditions is None:
        conditions = []
    if not isinstance(conditions, Sequence) or isinstance(conditions, (str, bytes)):

View on GitHub (pinned to 0132848349)

Solutions

  1. Clamp duration to the documented min/max
  2. Check for ms-vs-s unit confusion (6000 -> 6)
  3. Read the constants MINIMAX_H3_MIN/MAX_DURATION_SECONDS and validate client-side

Example fix

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

Strategy: validation

Validate before calling

d = target['duration_seconds'] = min(max(d, MINIMAX_H3_MIN_DURATION_SECONDS), MINIMAX_H3_MAX_DURATION_SECONDS)

Prevention

When it happens

Trigger: Requesting duration 2 or 30 when the supported range is e.g. [5, 12] seconds.

Common situations: Assuming the model supports arbitrary lengths; slider UI allowing wider ranges than the backend; unit confusion (milliseconds passed as seconds).

Related errors


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