sgl-project/sglang · error · ValueError

target.duration_seconds is required, or exactly one audio re

Error message

target.duration_seconds is required, or exactly one audio reference to derive duration from (including video/video_audio soundtracks; task {profile.task!r})

What it means

For duration-from-audio-reference task profiles, when target.duration_seconds is omitted the request must contain exactly one audio-bearing condition (type audio, video, or video_audio) to derive the output duration from. This error fires when there are zero such sources.

Source

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

    # one first/last keyframe signature. Type admission is handled by the task
    # profile; temporal ambiguity is validated later when target duration is
    # omitted.
    if not profile.video_reference_supported:
        for index, cond in enumerate(normalized_conditions):
            if cond["type"] in ("video", "video_audio"):
                raise ValueError(
                    f"conditions[{index}]: video references are not supported "
                    f"in v1 for task {profile.task!r} (image/audio only)"
                )
    if normalized_target.get("duration_seconds") is None:
        # Only reachable for duration_from_audio_reference profiles.
        duration_sources = [
            cond
            for cond in normalized_conditions
            if cond["type"] in ("audio", "video", "video_audio")
        ]
        if not duration_sources:
            raise ValueError(
                "target.duration_seconds is required, or exactly one "
                "audio reference to derive duration from (including "
                f"video/video_audio soundtracks; task {profile.task!r})"
            )
        if len(duration_sources) > 1:
            raise ValueError(
                "target.duration_seconds is required when multiple "
                "audio-bearing references are provided"
            )

    canonical: dict[str, Any] = {
        "schema": MINIMAX_H3_REQUEST_SCHEMA,
        "task": task_name,
        "prompt": prompt_text,
        "conditions": normalized_conditions,
        "target": normalized_target,
    }
    normalized_flow_shift = _optional_positive_finite_float(flow_shift, "flow_shift")

View on GitHub (pinned to 0132848349)

Solutions

  1. Set an explicit target.duration_seconds (within the released 4–15s range)
  2. Or include exactly one audio-bearing reference (type 'audio', 'video', or 'video_audio') to derive duration from

Example fix

// before
{"target":{}}
// after
{"target":{"duration_seconds":8}}
Defensive patterns

Strategy: validation

Validate before calling

def duration_ok(target, conditions):
    if target.get("duration_seconds") is not None: return True
    n = sum(c.get("type") in ("audio","video","video_audio") for c in conditions)
    return n == 1

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Calling minimax_h3_validate_canonical_request with target.duration_seconds unset and all conditions of type 'image' (no audio/video/video_audio entry).

Common situations: Building an image-only fl2va request and forgetting duration; assuming the model infers duration from keyframes alone.

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/25c24f16b9f1a583. Report an issue: GitHub.