jackc/pgx · error

cannot scan NULL into %T

Error message

cannot scan NULL into %T

What it means

Error "cannot scan NULL into %T" thrown in jackc/pgx.

Source

Thrown at pgtype/uint32.go:279

func (c Uint32Codec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error) {
	if src == nil {
		return nil, nil
	}

	var n uint32
	err := codecScan(c, m, oid, format, src, &n)
	if err != nil {
		return nil, err
	}
	return n, nil
}

type scanPlanBinaryUint32ToUint32 struct{}

func (scanPlanBinaryUint32ToUint32) Scan(src []byte, dst any) error {
	if src == nil {
		return fmt.Errorf("cannot scan NULL into %T", dst)
	}

	raw, err := pgio.Uint32Exact(src)
	if err != nil {
		return fmt.Errorf("uint32: %w", err)
	}

	p := (dst).(*uint32)
	*p = raw

	return nil
}

type scanPlanBinaryUint32ToUint32Scanner struct{}

func (scanPlanBinaryUint32ToUint32Scanner) Scan(src []byte, dst any) error {
	s, ok := (dst).(Uint32Scanner)
	if !ok {

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/uint32.go:279 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/6cac2ee58ede95fc.json. Report an issue: GitHub.