jackc/pgx · error
numeric incomplete
Error message
numeric incomplete: %w
What it means
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.)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pgtype/numeric.go:637 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of jackc/pgx@ec1a0befd2 (2026-08-04).
Data as JSON: /api/errors/a76fe3c1646e9be8.
Report an issue: GitHub.
Appendix: source
Thrown at pgtype/numeric.go:637
}
type scanPlanBinaryNumericToNumericScanner struct{}
func (scanPlanBinaryNumericToNumericScanner) Scan(src []byte, dst any) error {
scanner := (dst).(NumericScanner)
if src == nil {
return scanner.ScanNumeric(Numeric{})
}
r := pgio.NewReader(src)
ndigits := r.Uint16()
weight := r.Int16()
sign := r.Uint16()
dscale := r.Int16()
if err := r.Err(); err != nil {
return fmt.Errorf("numeric incomplete: %w", err)
}
switch sign {
case pgNumericNaNSign:
return scanner.ScanNumeric(Numeric{NaN: true, Valid: true})
case pgNumericPosInfSign:
return scanner.ScanNumeric(Numeric{InfinityModifier: Infinity, Valid: true})
case pgNumericNegInfSign:
return scanner.ScanNumeric(Numeric{InfinityModifier: NegativeInfinity, Valid: true})
}
if ndigits == 0 {
return scanner.ScanNumeric(Numeric{Int: big.NewInt(0), Valid: true})
}
if r.Remaining() < int(ndigits)*2 {
return fmt.Errorf("numeric incomplete %v", src)
}View on GitHub (pinned to ec1a0befd2)