sgl-project/sglang · error · ValueError
{path}.short_edge must be positive, got {short_edge}
Error message
{path}.short_edge must be positive, got {short_edge} What it means
Raised by the MiniMax-H3 canonical request validator when target.short_edge is an integer <= 0. short_edge controls the shorter output dimension and must be a positive int; the recommended value is MINIMAX_H3_RECOMMENDED_SHORT_EDGE, which also suppresses an 'unverified configuration' warning.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py:89
return None
if isinstance(value, bool) or not isinstance(value, (int, float)):
raise ValueError(f"{path} must be a number")
normalized = float(value)
if not math.isfinite(normalized) or normalized < 0.0:
raise ValueError(f"{path} must be a non-negative finite number")
return normalized
def _validate_target(target: Any, *, profile: MiniMaxH3TaskProfile) -> dict[str, Any]:
path = "target"
if not isinstance(target, Mapping):
raise ValueError(f"{path} is required and must be an object")
# The canonical target has a deliberately small projection. Transport
# compatibility keys are ignored; only these three declared values are
# validated and emitted below.
short_edge = _require_int(target.get("short_edge"), f"{path}.short_edge")
if short_edge <= 0:
raise ValueError(f"{path}.short_edge must be positive, got {short_edge}")
if short_edge != MINIMAX_H3_RECOMMENDED_SHORT_EDGE:
# Same guard the resolver applies. Without it the recommended value warns
# that it is "outside the verified configuration", naming itself as the
# verified one.
warn_unverified_short_edge(short_edge)
aspect_ratio = _require_str(target.get("aspect_ratio"), f"{path}.aspect_ratio")
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(View on GitHub (pinned to 0132848349)
Solutions
- Set short_edge to MINIMAX_H3_RECOMMENDED_SHORT_EDGE (the verified default)
- Ensure any computed short_edge is clamped to >= 1 before submission
- Audit config templates for 0/None placeholders that reach the validator
Example fix
// before
{"target": {"short_edge": 0, "aspect_ratio": "auto"}}
// after
{"target": {"short_edge": 768, "aspect_ratio": "auto"}} Defensive patterns
Strategy: validation
Validate before calling
if not isinstance(target['short_edge'], int) or target['short_edge'] <= 0:
raise ValueError('short_edge must be a positive integer') Type guard
def is_valid_short_edge(v) -> bool:
return isinstance(v, int) and not isinstance(v, bool) and v > 0 Prevention
- Default short_edge to MINIMAX_H3_RECOMMENDED_SHORT_EDGE
- Clamp computed dimensions to >= 1
When it happens
Trigger: Calling minimax_h3_validate_canonical_request with a target dict where short_edge is 0 or negative (e.g. copied from a placeholder or computed from a subtraction that underflowed).
Common situations: Defaulting short_edge to 0 in a config template; computing it as height - crop where crop > height; passing a bool (False == 0) after _require_int accepted it via bool-int equivalence.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- MiniMax-H3 adaln_t_table must have shape [N, D] with N >= 2,
- MiniMax H3 AdaLN cache has invalid timestep plans
- TP size must be positive.
- num_attention_heads must be positive.
- hidden_size must be positive.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/e769bc6ab6516095.
Report an issue: GitHub.