{"record":{"id":"17148dc7fe32d5d5","repo":"nats-io/nats-server","slug":"float-s-is-out-of-the-range","errorCode":null,"errorMessage":"float '%s' is out of the range","messagePattern":"float '(.+?)' is out of the range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"conf/parse.go","lineNumber":354,"sourceCode":"\t\tcase \"t\":\n\t\t\tsetValue(it, num*1000*1000*1000*1000)\n\t\tcase \"tb\", \"ti\", \"tib\":\n\t\t\tsetValue(it, num*1024*1024*1024*1024)\n\t\tcase \"p\":\n\t\t\tsetValue(it, num*1000*1000*1000*1000*1000)\n\t\tcase \"pb\", \"pi\", \"pib\":\n\t\t\tsetValue(it, num*1024*1024*1024*1024*1024)\n\t\tcase \"e\":\n\t\t\tsetValue(it, num*1000*1000*1000*1000*1000*1000)\n\t\tcase \"eb\", \"ei\", \"eib\":\n\t\t\tsetValue(it, num*1024*1024*1024*1024*1024*1024)\n\t\t}\n\tcase itemFloat:\n\t\tnum, err := strconv.ParseFloat(it.val, 64)\n\t\tif err != nil {\n\t\t\tif e, ok := err.(*strconv.NumError); ok &&\n\t\t\t\te.Err == strconv.ErrRange {\n\t\t\t\treturn fmt.Errorf(\"float '%s' is out of the range\", it.val)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"expected float, but got '%s'\", it.val)\n\t\t}\n\t\tsetValue(it, num)\n\tcase itemBool:\n\t\tswitch strings.ToLower(it.val) {\n\t\tcase \"true\", \"yes\", \"on\":\n\t\t\tsetValue(it, true)\n\t\tcase \"false\", \"no\", \"off\":\n\t\t\tsetValue(it, false)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"expected boolean value, but got '%s'\", it.val)\n\t\t}\n\n\tcase itemDatetime:\n\t\tdt, err := time.Parse(\"2006-01-02T15:04:05Z\", it.val)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/conf/parse.go#L336-L372","documentation":"During config parsing, an item classified as a float was parsed with strconv.ParseFloat, which returned a *strconv.NumError wrapping strconv.ErrRange. That means the literal is syntactically a number but its magnitude exceeds the float64 range (overflow to ±Inf or underflow toward 0 not representable). The parser rejects it instead of silently storing an Inf/0 value.","triggerScenarios":"processItem (invoked from parse) hits case itemFloat with it.val such as '1e400' or '1.8e309'; ParseFloat fails with ErrRange.","commonSituations":"Config files with placeholder or auto-generated huge numbers (e.g. sentinel values like 9999999999e999), copied constants from other languages beyond float64 max (~1.8e308), or typos with too many digits.","solutions":["Edit the config value to a number within float64 range (|x| < ~1.7976931348623157e308).","If a sentinel 'infinity' is intended, use a string or a large-but-valid literal like 1e308 and interpret it in application code.","Check for accidental digit/zero repetition (pasted IDs, concatenated numbers).","Quote the value as a string if you need the literal verbatim and will convert it yourself."],"exampleFix":"// before\nrate_limit = 1e400\n// after\nrate_limit = 1e308","handlingStrategy":"validation","validationCode":"for _, v := range floatValues {\n\tf, err := strconv.ParseFloat(v, 64)\n\tif err != nil || math.IsInf(f, 0) {\n\t\treturn fmt.Errorf(\"float %q out of float64 range\", v)\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep config floats well below float64 max (~1.8e308).","Never use huge literals as infinity sentinels; use strings or named constants.","Lint generated configs for suspicious number magnitudes."],"tags":["config","parsing","float","range"],"backgroundTag":"number-out-of-range","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}