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/uint64.go:250

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

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

type scanPlanBinaryUint64ToUint64 struct{}

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

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

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

	return nil
}

type scanPlanBinaryUint64ToUint64Scanner struct{}

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

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/uint64.go:250 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/9361e4f312994731.json. Report an issue: GitHub.