{"record":{"id":"f77563b52a8c29ad","repo":"JuliusBrussee/caveman","slug":"invalid-or-oversized-json-number","errorCode":null,"errorMessage":"invalid or oversized JSON number","messagePattern":"invalid or oversized JSON number","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/proposalrun/proposalrun.go","lineNumber":212,"sourceCode":"\t\tmantissaEnd = i\n\t\tvar err error\n\t\texponent, err = parseJSONExponent(literal[i+1:])\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tmantissa := literal[start:mantissaEnd]\n\tdot := strings.IndexByte(mantissa, '.')\n\tif dot < 0 {\n\t\tdot = len(mantissa)\n\t}\n\tintegerPart := mantissa[:dot]\n\tfractionPart := \"\"\n\tif dot < len(mantissa) {\n\t\tfractionPart = mantissa[dot+1:]\n\t}\n\tif len(integerPart) == 0 || len(integerPart)+len(fractionPart) > maxJSONBNumberCoefficient {\n\t\treturn \"\", fmt.Errorf(\"invalid or oversized JSON number\")\n\t}\n\tfor i := 0; i < len(integerPart); i++ {\n\t\tif integerPart[i] < '0' || integerPart[i] > '9' {\n\t\t\treturn \"\", fmt.Errorf(\"invalid JSON number\")\n\t\t}\n\t}\n\tfor i := 0; i < len(fractionPart); i++ {\n\t\tif fractionPart[i] < '0' || fractionPart[i] > '9' {\n\t\t\treturn \"\", fmt.Errorf(\"invalid JSON number\")\n\t\t}\n\t}\n\t// PostgreSQL numeric retains the input display scale in jsonb output,\n\t// including trailing fractional zeroes. Validate the raw scale before the\n\t// canonical reduction below strips those zeroes; otherwise a value such as\n\t// 1.0000e-16383 would reduce to a representable scale while its original\n\t// jsonb insert would fail at the 16383-digit numeric limit.\n\trawScale := len(fractionPart) - exponent\n\tif rawScale > maxJSONBNumericFractionDigits {","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/platform/proposalrun/proposalrun.go#L194-L230","documentation":"Error from normalizeJSONNumber while canonicalizing a JSON number for PostgreSQL jsonb storage: the mantissa has no integer digits or its total coefficient digits exceed the allowed jsonb number coefficient limit, so the literal cannot be stored as a jsonb numeric.","triggerScenarios":"Thrown at shared/platform/proposalrun/proposalrun.go:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rescale or round the number before storing it (e.g. exponent-form very large/small values)","Store the value as a string if exact display matters more than numeric typing","Reject the input at the API boundary with a clearer domain-specific message"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}