sgl-project/sglang · error · ValueError

{path}.duration_seconds is required

Error message

{path}.duration_seconds is required

What it means

target.duration_seconds is missing and the task profile cannot derive duration from an audio reference (duration_from_audio_reference is false). Text-to-video style tasks need an explicit output duration.

Source

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

    if profile.aspect_ratio_forced_auto and aspect_ratio != "auto":
        raise ValueError(
            f'{path}.aspect_ratio must be "auto" for task {profile.task!r}, '
            f"got {aspect_ratio!r}"
        )
    has_duration = target.get("duration_seconds") is not None
    if (
        profile.task in {MINIMAX_H3_TASK_T2VA, MINIMAX_H3_TASK_REF2VA}
        and aspect_ratio != "auto"
        and aspect_ratio not in MINIMAX_H3_FINITE_ASPECT_RATIOS
    ):
        raise ValueError(
            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(

View on GitHub (pinned to 0132848349)

Solutions

  1. Add target.duration_seconds (a positive number within the min/max bounds)
  2. If the task supports it, attach an audio reference condition so duration is derived

Example fix

// before
{"short_edge": 768, "aspect_ratio": "16:9"}
// after
{"short_edge": 768, "aspect_ratio": "16:9", "duration_seconds": 6}
Defensive patterns

Strategy: validation

Validate before calling

if target.get('duration_seconds') is None and not profile.duration_from_audio_reference:
    target['duration_seconds'] = 6  # sane default within bounds

Prevention

When it happens

Trigger: Omitting duration_seconds entirely for a task where profile.duration_from_audio_reference is false and no default exists.

Common situations: Building a minimal request dict and forgetting duration; assuming the server has a default duration; migrating from an API that defaulted duration.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


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