jackc/pgx · error
cannot scan into *uint64
Error message
cannot scan into *uint64: %w
What it means
Wrapper guard in uint64Wrapper.ScanNumeric: converting the incoming Numeric to a big.Int failed (malformed/unexpected numeric state), and the failure is re-wrapped while scanning into a *uint64.
Solutions
- Inspect the wrapped error to see why the numeric could not be converted
- Scan into pgtype.Numeric to accept arbitrary precision
- Ensure the source numeric is a plain integer value
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pgtype/builtin_wrappers.go:234 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/3c44d4b0ec590689.
Report an issue: GitHub.
Appendix: source
Thrown at pgtype/builtin_wrappers.go:234
return nil
}
func (w uint64Wrapper) Int64Value() (Int8, error) {
if uint64(w) > uint64(math.MaxInt64) {
return Int8{}, fmt.Errorf("%d is greater than maximum value for int64", w)
}
return Int8{Int64: int64(w), Valid: true}, nil
}
func (w *uint64Wrapper) ScanNumeric(v Numeric) error {
if !v.Valid {
return fmt.Errorf("cannot scan NULL into *uint64")
}
bi, err := v.toBigInt()
if err != nil {
return fmt.Errorf("cannot scan into *uint64: %w", err)
}
if !bi.IsUint64() {
return fmt.Errorf("cannot scan %v into *uint64", bi.String())
}
*w = uint64Wrapper(bi.Uint64())
return nil
}
func (w uint64Wrapper) NumericValue() (Numeric, error) {
return Numeric{Int: new(big.Int).SetUint64(uint64(w)), Valid: true}, nil
}
type uintWrapper uint
func (w uintWrapper) SkipUnderlyingTypePlan() {}View on GitHub (pinned to ec1a0befd2)