{"record":{"id":"e75e88989794a0c2","repo":"sgl-project/sglang","slug":"seed-must-be-non-negative-got-normalized-seed","errorCode":null,"errorMessage":"seed must be non-negative, got {normalized_seed}","messagePattern":"seed must be non-negative, got (.+?)","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":372,"sourceCode":"    canonical: dict[str, Any] = {\n        \"schema\": MINIMAX_H3_REQUEST_SCHEMA,\n        \"task\": task_name,\n        \"prompt\": prompt_text,\n        \"conditions\": normalized_conditions,\n        \"target\": normalized_target,\n    }\n    normalized_flow_shift = _optional_positive_finite_float(flow_shift, \"flow_shift\")\n    normalized_audio_flow_shift = _optional_positive_finite_float(\n        audio_flow_shift, \"audio_flow_shift\"\n    )\n    if normalized_flow_shift is not None:\n        canonical[\"flow_shift\"] = normalized_flow_shift\n    if normalized_audio_flow_shift is not None:\n        canonical[\"audio_flow_shift\"] = normalized_audio_flow_shift\n    if seed is not None:\n        normalized_seed = _require_int(seed, \"seed\")\n        if normalized_seed < 0:\n            raise ValueError(f\"seed must be non-negative, got {normalized_seed}\")\n        if normalized_seed > MINIMAX_H3_MAX_SIGNED_SEED:\n            raise ValueError(\n                f\"seed must not exceed the signed int64 maximum, got {normalized_seed}\"\n            )\n        canonical[\"seed\"] = normalized_seed\n    return canonical\n\n\n__all__ = [\n    \"MINIMAX_H3_REQUEST_SCHEMA\",\n    \"MINIMAX_H3_MAX_SIGNED_SEED\",\n    \"MINIMAX_H3_SUPPORTED_FPS\",\n    \"minimax_h3_validate_canonical_request\",\n]\n","sourceCodeStart":354,"sourceCodeEnd":387,"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#L354-L387","documentation":"The optional `seed` field of a MiniMax-H3 canonical request must be a non-negative integer. The validator normalizes it with _require_int and rejects negative values with this error.","triggerScenarios":"Calling minimax_h3_validate_canonical_request with seed set to a negative integer (e.g. -1) to 'randomize'.","commonSituations":"Porting code from another API where seed=-1 means random; passing -1 as a sentinel for unspecified.","solutions":["Use a non-negative integer seed, or omit seed entirely to let the server choose","Use a different sentinel (None) for 'unspecified'"],"exampleFix":"// before\n{\"seed\":-1}\n// after\n{\"seed\":42}  // or omit the key","handlingStrategy":"validation","validationCode":"def seed_ok(seed):\n    return seed is None or (isinstance(seed, int) and not isinstance(seed, bool) and seed >= 0)","typeGuard":"def is_valid_seed(v) -> bool: return v is None or (type(v) is int and 0 <= v <= 2**63 - 1)","tryCatchPattern":"null","preventionTips":["Never use -1 as a 'random' sentinel; use None"],"tags":["minimax-h3","seed","validation"],"backgroundTag":"invalid-parameter-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}