sgl-project/sglang · error · ValueError

{cpath}: {exc}

Error message

{cpath}: {exc}

What it means

The (role, type) pair has no matching rule in the task profile — profile.rule_for(role=..., condition_type=...) raised ValueError, which is re-raised with the conditions[i] path prefix. E.g. 'reference' + 'video' when the task only accepts image references.

Source

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

        cpath = f"{path}[{index}]"
        if not isinstance(cond, Mapping):
            raise ValueError(f"{cpath} must be an object")
        unknown = set(cond) - _ALLOWED_CONDITION_KEYS
        if unknown:
            raise ValueError(f"{cpath} has unknown fields: {sorted(unknown)}")
        role = _require_str(cond.get("role"), f"{cpath}.role")
        if role not in (
            MINIMAX_H3_CONDITION_ROLE_KEYFRAME,
            MINIMAX_H3_CONDITION_ROLE_REFERENCE,
        ):
            raise ValueError(
                f"{cpath}.role must be keyframe or reference, " f"got {role!r}"
            )
        cond_type = _require_str(cond.get("type"), f"{cpath}.type")
        try:
            rule = profile.rule_for(role=role, condition_type=cond_type)
        except ValueError as exc:
            raise ValueError(f"{cpath}: {exc}") from exc
        uri = _require_str(cond.get("uri"), f"{cpath}.uri")

        entry: dict[str, Any] = {"type": cond_type, "uri": uri, "role": role}
        if rule.requires_frame_index:
            frame_index = _require_int(cond.get("frame_index"), f"{cpath}.frame_index")
            if aligned_frame_count is None:
                raise ValueError(
                    f"{cpath}.frame_index requires a resolved target duration"
                )
            if frame_index == -1:
                resolved = aligned_frame_count - 1
            elif 0 <= frame_index < aligned_frame_count:
                resolved = frame_index
            else:
                raise ValueError(
                    f"{cpath}.frame_index must be -1 or in "
                    f"[0, {aligned_frame_count}) after 17n+5 frame alignment, "
                    f"got {frame_index}"

View on GitHub (pinned to 0132848349)

Solutions

  1. Use a (role, type) combination the task profile declares (e.g. keyframe+image, reference+image/video)
  2. Inspect profile.rule_for / the task's rule table to see allowed pairs
  3. Switch task if the needed conditioning type isn't supported

Example fix

// before
{"role": "keyframe", "type": "audio", "uri": "a.mp3"}
// after
{"role": "reference", "type": "audio", "uri": "a.mp3"}
Defensive patterns

Strategy: try-catch

Validate before calling

try:
    profile.rule_for(role=cond['role'], condition_type=cond['type'])
except ValueError:
    raise ValueError('unsupported (role, type) for this task')

Try / catch

try:
    validate(req)
except ValueError as e:
    if 'conditions[' in str(e):
        surface_to_user(e)  # per-entry condition errors are user-fixable
    raise

Prevention

When it happens

Trigger: Sending type 'audio' for role 'keyframe', or any role/type combination the task doesn't support.

Common situations: Assuming all media types work for every role; task profiles differing in supported condition types.

Related errors


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