{"record":{"id":"a76fe3c1646e9be8","repo":"jackc/pgx","slug":"numeric-incomplete-w","errorCode":null,"errorMessage":"numeric incomplete: %w","messagePattern":"numeric incomplete: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/numeric.go","lineNumber":637,"sourceCode":"}\n\ntype scanPlanBinaryNumericToNumericScanner struct{}\n\nfunc (scanPlanBinaryNumericToNumericScanner) Scan(src []byte, dst any) error {\n\tscanner := (dst).(NumericScanner)\n\n\tif src == nil {\n\t\treturn scanner.ScanNumeric(Numeric{})\n\t}\n\n\tr := pgio.NewReader(src)\n\n\tndigits := r.Uint16()\n\tweight := r.Int16()\n\tsign := r.Uint16()\n\tdscale := r.Int16()\n\tif err := r.Err(); err != nil {\n\t\treturn fmt.Errorf(\"numeric incomplete: %w\", err)\n\t}\n\n\tswitch sign {\n\tcase pgNumericNaNSign:\n\t\treturn scanner.ScanNumeric(Numeric{NaN: true, Valid: true})\n\tcase pgNumericPosInfSign:\n\t\treturn scanner.ScanNumeric(Numeric{InfinityModifier: Infinity, Valid: true})\n\tcase pgNumericNegInfSign:\n\t\treturn scanner.ScanNumeric(Numeric{InfinityModifier: NegativeInfinity, Valid: true})\n\t}\n\n\tif ndigits == 0 {\n\t\treturn scanner.ScanNumeric(Numeric{Int: big.NewInt(0), Valid: true})\n\t}\n\n\tif r.Remaining() < int(ndigits)*2 {\n\t\treturn fmt.Errorf(\"numeric incomplete %v\", src)\n\t}","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/numeric.go#L619-L655","documentation":"When decoding a binary numeric, the header (ndigits, weight, sign, dscale — 8 bytes) is read first. This wrapper fires when the reader signals an error during those header reads — the payload is shorter than the fixed numeric header, i.e. a truncated binary numeric value. (The RAISED-IN attribution to encodeNumericText is incidental; the guard is in the binary scan plan.)","triggerScenarios":"Thrown at pgtype/numeric.go:637 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the binary numeric payload is complete (at least 8 bytes) and uncorrupted","Use text format for numeric columns as a workaround","Report as a driver bug if the value came directly from the server"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}