jackc/pgx · error

cannot scan %v into *uint

Error message

cannot scan %v into *uint

What it means

Error "cannot scan %v into *uint" thrown in jackc/pgx.

Source

Thrown at pgtype/builtin_wrappers.go:291

	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 *uintWrapper) ScanNumeric(v Numeric) error {
	if !v.Valid {
		return fmt.Errorf("cannot scan NULL into *uint")
	}

	bi, err := v.toBigInt()
	if err != nil {
		return fmt.Errorf("cannot scan into *uint: %w", err)
	}

	if !bi.IsUint64() {
		return fmt.Errorf("cannot scan %v into *uint", bi.String())
	}

	ui := bi.Uint64()

	if math.MaxUint < ui {
		return fmt.Errorf("cannot scan %v into *uint", ui)
	}

	*w = uintWrapper(ui)

	return nil
}

func (w uintWrapper) NumericValue() (Numeric, error) {
	return Numeric{Int: new(big.Int).SetUint64(uint64(w)), Valid: true}, nil
}

type float32Wrapper float32

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/builtin_wrappers.go:291 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: /data/errors/081b09e42626e779.json. Report an issue: GitHub.