{"record":{"id":"bbc0c156fef0461f","repo":"JuliusBrussee/caveman","slug":"json-number-exceeds-postgresql-fraction-digit-limi","errorCode":null,"errorMessage":"JSON number exceeds PostgreSQL fraction-digit limit","messagePattern":"JSON number exceeds PostgreSQL fraction-digit limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/proposalrun/proposalrun.go","lineNumber":231,"sourceCode":"\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 {\n\t\treturn \"\", fmt.Errorf(\"JSON number exceeds PostgreSQL fraction-digit limit\")\n\t}\n\n\tdigits := strings.TrimLeft(integerPart+fractionPart, \"0\")\n\tif digits == \"\" {\n\t\treturn \"0\", nil\n\t}\n\tscale := len(fractionPart) - exponent\n\tfor scale > 0 && strings.HasSuffix(digits, \"0\") {\n\t\tdigits = digits[:len(digits)-1]\n\t\tscale--\n\t}\n\n\tvar out string\n\tswitch {\n\tcase scale <= 0:\n\t\tzeros := -scale\n\t\tif zeros > maxJSONBNumericIntegerDigits-len(digits) {\n\t\t\treturn \"\", fmt.Errorf(\"JSON number exceeds PostgreSQL integer-digit limit\")","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/shared/platform/proposalrun/proposalrun.go#L213-L249","documentation":"Error \"JSON number exceeds PostgreSQL fraction-digit limit\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at shared/platform/proposalrun/proposalrun.go:231 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the number's fraction digits below the PostgreSQL limit."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}