sgl-project/sglang · error · ValueError
{path} must be an integer
Error message
{path} must be an integer What it means
_require_int enforces integer fields (e.g. target.short_edge, condition frame_index) in the canonical request. Python bools are explicitly rejected even though bool subclasses int.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py:54
minimax_h3_align_frame_count,
)
MINIMAX_H3_REQUEST_SCHEMA = "minimax_h3.request/v1"
MINIMAX_H3_MAX_SIGNED_SEED = (1 << 63) - 1
_ALLOWED_CONDITION_KEYS = frozenset(
{"type", "uri", "role", "frame_index", "start_time_seconds"}
)
def _require_str(value: Any, path: str) -> str:
if not isinstance(value, str) or value == "":
raise ValueError(f"{path} must be a non-empty string")
return value
def _require_int(value: Any, path: str) -> int:
if isinstance(value, bool) or not isinstance(value, int):
raise ValueError(f"{path} must be an integer")
return value
def _optional_positive_finite_float(value: Any, path: str) -> float | None:
if value is None:
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 positive finite number")
return normalized
def _optional_nonnegative_finite_float(value: Any, path: str) -> float | None:
if value is None:
return None
if isinstance(value, bool) or not isinstance(value, (int, float)):View on GitHub (pinned to 0132848349)
Solutions
- Send a true JSON integer (no quotes, no decimal point) at the path named in the message
- Convert with int(value) client-side after confirming it is integral
- Never put booleans in numeric fields
Example fix
# before
{"short_edge": "512"}
# after
{"short_edge": 512} Defensive patterns
Strategy: type-guard
Validate before calling
assert isinstance(v, int) and not isinstance(v, bool), f"{path} must be an integer" Type guard
from numbers import Integral
def is_int(v: Any) -> bool:
return isinstance(v, Integral) and not isinstance(v, bool) Prevention
- Send JSON integers without quotes/decimals
- Parse with parse_int enforcement or pydantic StrictInt
When it happens
Trigger: Passing target.short_edge = "512", 512.0, None, or True to minimax_h3_validate_canonical_request.
Common situations: JSON numbers arriving as floats or numeric strings from loosely typed clients, or a boolean flag accidentally placed in an int field.
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
- {path} must be a number
- MiniMax H3 request task must be a non-empty string
- MiniMax H3 requires num_inference_steps >= 2 because its vid
- quality must be one of {list(QUALITY_LEVELS)}, got {quality!
- {path} must be a non-empty string
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/176ff547e7bb0414.
Report an issue: GitHub.