sgl-project/sglang · error · ValueError
{cpath} must be an object
Error message
{cpath} must be an object What it means
An individual entry in the conditions list is not a Mapping/object — e.g. it is a string URI or a list.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py:189
)
if (
profile.max_condition_count is not None
and len(conditions) > profile.max_condition_count
):
raise ValueError(
f"{path} allows at most {profile.max_condition_count} entries "
f"for task {profile.task!r}, got {len(conditions)}"
)
aligned_frame_count = (
minimax_h3_align_frame_count(frame_count) if frame_count is not None else None
)
normalized: list[dict[str, Any]] = []
seen_frame_indices: dict[int, int] = {}
for index, cond in enumerate(conditions):
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")
View on GitHub (pinned to 0132848349)
Solutions
- Make every list entry an object with role/type/uri fields
- Validate each entry with an isinstance Mapping check client-side
Example fix
// before
"conditions": ["ref.png"]
// after
"conditions": [{"role": "reference", "type": "image", "uri": "ref.png"}] Defensive patterns
Strategy: type-guard
Validate before calling
conditions = [c for c in conditions if isinstance(c, dict)] assert len(conditions) == len(original)
Type guard
def is_condition_object(v) -> bool:
return isinstance(v, dict) Prevention
- Reject raw URI strings in the client schema
When it happens
Trigger: conditions: ["ref.png"] instead of [{"role": ..., "uri": "ref.png"}].
Common situations: Shorthand URI lists from internal tooling; mixed-format arrays after JSON round-trips.
Related errors
- {path} must be a list
- {path}.duration_seconds must be a number
- {path} must be empty for task {profile.task!r} (got {len(con
- {path} requires at least one entry for task {profile.task!r}
- {path} requires at least {profile.min_condition_count} entri
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/e9eeee50089c91e1.
Report an issue: GitHub.