{"record":{"id":"c494e4f2aec74dab","repo":"sgl-project/sglang","slug":"path-must-be-a-non-negative-finite-number","errorCode":null,"errorMessage":"{path} must be a non-negative finite number","messagePattern":"(.+?) must be a non-negative finite 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":76,"sourceCode":"def _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]:\n    path = \"target\"\n    if not isinstance(target, Mapping):\n        raise ValueError(f\"{path} is required and must be an object\")\n    # The canonical target has a deliberately small projection.  Transport\n    # compatibility keys are ignored; only these three declared values are\n    # validated and emitted below.\n    short_edge = _require_int(target.get(\"short_edge\"), f\"{path}.short_edge\")\n    if short_edge <= 0:\n        raise ValueError(f\"{path}.short_edge must be positive, got {short_edge}\")\n    if short_edge != MINIMAX_H3_RECOMMENDED_SHORT_EDGE:\n        # Same guard the resolver applies. Without it the recommended value warns\n        # that it is \"outside the verified configuration\", naming itself as the\n        # verified one.\n        warn_unverified_short_edge(short_edge)","sourceCodeStart":58,"sourceCodeEnd":94,"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#L58-L94","documentation":"Optional non-negative condition floats must be finite and >= 0. Negative values, -inf, and NaN raise this error (unlike the positive variant, 0.0 is allowed).","triggerScenarios":"Passing start_time_seconds = -0.1, float('nan'), or -inf in a request's conditions block.","commonSituations":"Clock/reference mismatches producing small negative timestamps, or NaN propagating from upstream arithmetic on unset values.","solutions":["Clamp to max(0.0, v) after confirming finiteness client-side","Fix timestamp computation so offsets are non-negative","Check for NaN before serializing (json allows it by default)"],"exampleFix":"# before\n{\"start_time_seconds\": -0.1}\n# after\n{\"start_time_seconds\": 0.0}","handlingStrategy":"validation","validationCode":"import math\nassert v is None or (math.isfinite(v) and v >= 0), f\"{path} must be non-negative finite\"","typeGuard":"import math\ndef opt_nonneg_finite(v: Any) -> bool:\n    return v is None or (isinstance(v, (int, float)) and math.isfinite(v) and v >= 0)","tryCatchPattern":null,"preventionTips":["Clamp timestamps with max(0.0, v)","Guard arithmetic on differences that can go negative"],"tags":["minimax-h3","request-validation","non-negative-float","nan-inf"],"backgroundTag":"schema-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}