{"record":{"id":"09efda13b412b4c2","repo":"sgl-project/sglang","slug":"path-must-be-a-positive-finite-number","errorCode":null,"errorMessage":"{path} must be a positive finite number","messagePattern":"(.+?) must be a positive 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":65,"sourceCode":"    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]:\n    path = \"target\"\n    if not isinstance(target, Mapping):\n        raise ValueError(f\"{path} is required and must be an object\")","sourceCodeStart":47,"sourceCodeEnd":83,"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#L47-L83","documentation":"After the numeric check, optional positive float fields must be finite (> 0, not inf/nan). Zero, negative values, float('inf'), and NaN all raise this error.","triggerScenarios":"Passing duration = 0, -1.5, float('nan'), or float('inf') to an optional positive float field; NaN slips past naive comparisons, hence the explicit math.isfinite check.","commonSituations":"Computed values that degenerate to 0 (e.g. end - start when equal), un sanitized client math producing NaN/inf, or treating the field as allowing zero.","solutions":["Guard the value with math.isfinite(v) and v > 0 before sending","Fix upstream arithmetic that yields 0/NaN/inf (e.g. equal timestamps)","Omit the field (null) when it genuinely has no value"],"exampleFix":"# before\n{\"duration_seconds\": 0.0}\n# after\n{\"duration_seconds\": 2.0}  # or omit the key","handlingStrategy":"validation","validationCode":"import math\nassert v is None or (math.isfinite(v) and v > 0), f\"{path} must be positive finite\"","typeGuard":"import math\ndef opt_pos_finite(v: Any) -> bool:\n    return v is None or (isinstance(v, (int, float)) and math.isfinite(v) and v > 0)","tryCatchPattern":null,"preventionTips":["Reject NaN/inf before serialization (json.dumps allows them by default)","Sanitize computed durations/gains before submit"],"tags":["minimax-h3","request-validation","positive-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"}