sgl-project/sglang · error · ValueError

{path} must be a list

Error message

{path} must be a list

What it means

The top-level conditions field is not a list/Sequence — it is a dict, string, number, etc. (str/bytes are explicitly excluded from counting as sequences). A single condition object instead of a list is the classic cause.

Source

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

                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)):
        raise ValueError(f"{path} must be a list")

    if not profile.conditions_required:
        if len(conditions) > 0:
            raise ValueError(
                f"{path} must be empty for task {profile.task!r} "
                f"(got {len(conditions)} entries)"
            )
        return []
    if len(conditions) == 0:
        raise ValueError(
            f"{path} requires at least one entry for task {profile.task!r}"
        )
    if (
        profile.min_condition_count is not None
        and len(conditions) < profile.min_condition_count
    ):
        raise ValueError(
            f"{path} requires at least {profile.min_condition_count} entries "

View on GitHub (pinned to 0132848349)

Solutions

  1. Wrap conditions in a list even for a single entry
  2. Pass [] (or omit, it defaults to []) when no conditions are needed

Example fix

// before
"conditions": {"role": "keyframe", ...}
// after
"conditions": [{"role": "keyframe", ...}]
Defensive patterns

Strategy: type-guard

Validate before calling

if not isinstance(conditions, list):
    conditions = [conditions] if isinstance(conditions, dict) else []

Type guard

def is_condition_list(v) -> bool:
    return isinstance(v, (list, tuple))

Prevention

When it happens

Trigger: Passing conditions={...} (one object) or conditions="keyframe" instead of conditions=[{...}].

Common situations: Wrapping a single condition without brackets; JSON schema drift where conditions became an object keyed by id.

Related errors


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