sgl-project/sglang · error · ValueError
target.short_edge must be an integer, got {value!r}
Error message
target.short_edge must be an integer, got {value!r} What it means
base_short_edge passed to minimax_h3_resolve_spatial_shape must be convertible to int. This error fires when float()/int() conversion raises TypeError (None) or ValueError (non-numeric string) inside _validate_base_short_edge.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/resolved_plan.py:104
raise ValueError(
f"target.aspect_ratio must be integer 'W:H', got {value!r}"
) from exc
if w <= 0 or h <= 0:
raise ValueError(
f"target.aspect_ratio components must be positive, got {value!r}"
)
return w, h
def _nearest_multiple(value: float, multiple: int) -> int:
return max(multiple, int(round(float(value) / multiple)) * multiple)
def _validate_base_short_edge(value: Any) -> int:
try:
short_edge = int(value)
except (TypeError, ValueError) as exc:
raise ValueError(
f"target.short_edge must be an integer, got {value!r}"
) from exc
if short_edge != value or short_edge <= 0:
raise ValueError(f"target.short_edge must be a positive integer, got {value!r}")
if short_edge != MINIMAX_H3_BASE_SHORT_EDGE:
warn_unverified_short_edge(short_edge)
return short_edge
def minimax_h3_resolve_spatial_shape(
*,
width: int | float,
height: int | float,
base_short_edge: int = MINIMAX_H3_BASE_SHORT_EDGE,
) -> dict[str, Any]:
"""Resolve one display ratio with the ``adapt_shape_v1`` math.
This is the only implementation of adaptive target geometry. Callers mayView on GitHub (pinned to 0132848349)
Solutions
- Pass an integer base short edge (nominally MINIMAX_H3_BASE_SHORT_EDGE)
- Coerce or default the value at the config boundary before calling the resolver
Example fix
# before resolve_spatial_shape(base_short_edge=config.short_edge) # None # after resolve_spatial_shape(base_short_edge=config.short_edge or MINIMAX_H3_BASE_SHORT_EDGE)
Defensive patterns
Strategy: validation
Validate before calling
def edge_ok(v):
try: return int(v) == v and int(v) > 0
except (TypeError, ValueError): return False Type guard
def is_valid_short_edge(v) -> bool:
try: return type(int(v)) is int and int(v) == v and int(v) > 0
except (TypeError, ValueError): return False Try / catch
null
Prevention
- Default optional config values to MINIMAX_H3_BASE_SHORT_EDGE
When it happens
Trigger: Calling minimax_h3_resolve_spatial_shape with base_short_edge=None, 'large', or another non-numeric value.
Common situations: Forwarding an unvalidated config field or JSON value straight into the resolver; optional CLI arg defaulting to None when omitted.
Related errors
- target.short_edge must be a positive integer, got {value!r}
- shape width and height must be positive finite numbers
- {path}.short_edge must be positive, got {short_edge}
- shape ratio must be a positive finite number
- adapt_shape_v1 ratio must be within the inclusive range 1:4
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/0d2bf6fcaea8c124.
Report an issue: GitHub.