{"record":{"id":"52bcdf58cb669bba","repo":"sgl-project/sglang","slug":"path-must-be-a-number","errorCode":null,"errorMessage":"{path} must be a number","messagePattern":"(.+?) must be a number","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py","lineNumber":62,"sourceCode":"\n\ndef _require_str(value: Any, path: str) -> str:\n    if not isinstance(value, str) or value == \"\":\n        raise ValueError(f\"{path} must be a non-empty string\")\n    return value\n\n\ndef _require_int(value: Any, path: str) -> int:\n    if isinstance(value, bool) or not isinstance(value, int):\n        raise ValueError(f\"{path} must be an integer\")\n    return value\n\n\ndef _optional_positive_finite_float(value: Any, path: str) -> float | None:\n    if value is None:\n        return None\n    if isinstance(value, bool) or not isinstance(value, (int, float)):\n        raise ValueError(f\"{path} must be a number\")\n    normalized = float(value)\n    if not math.isfinite(normalized) or normalized <= 0.0:\n        raise ValueError(f\"{path} must be a positive finite number\")\n    return normalized\n\n\ndef _optional_nonnegative_finite_float(value: Any, path: str) -> float | None:\n    if value is None:\n        return None\n    if isinstance(value, bool) or not isinstance(value, (int, float)):\n        raise ValueError(f\"{path} must be a number\")\n    normalized = float(value)\n    if not math.isfinite(normalized) or normalized < 0.0:\n        raise ValueError(f\"{path} must be a non-negative finite number\")\n    return normalized\n\n\ndef _validate_target(target: Any, *, profile: MiniMaxH3TaskProfile) -> dict[str, Any]:","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py#L44-L80","documentation":"Optional positive float fields (e.g. durations/gain values in the canonical request) must be numeric when present. _optional_positive_finite_float rejects bools and any non int/float value; None is allowed and means absent.","triggerScenarios":"Passing a string (\"2.0\"), bool, list, or dict where an optional positive float is expected in minimax_h3_validate_canonical_request.","commonSituations":"String-typed numerics from form data or query params, or a nested object mistakenly placed where a scalar belongs.","solutions":["Coerce to float client-side before sending","Keep the field as a JSON number or omit/null it","Check the path in the message to find the offending field"],"exampleFix":"# before\n{\"duration_seconds\": \"2.0\"}\n# after\n{\"duration_seconds\": 2.0}","handlingStrategy":"type-guard","validationCode":"assert v is None or (isinstance(v, (int, float)) and not isinstance(v, bool)), f\"{path} must be a number\"","typeGuard":"def opt_number(v: Any) -> bool:\n    return v is None or (isinstance(v, (int, float)) and not isinstance(v, bool))","tryCatchPattern":null,"preventionTips":["Coerce strings to float client-side","Use strict pydantic types for request models"],"tags":["minimax-h3","request-validation","float-field","type-check"],"backgroundTag":"schema-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}