jackc/pgx · error

cannot scan NULL into *[16]byte

Error message

cannot scan NULL into *[16]byte

What it means

Error "cannot scan NULL into *[16]byte" thrown in jackc/pgx.

Source

Thrown at pgtype/builtin_wrappers.go:659

		s := v
		hstore[k] = &s
	}
	return hstore, nil
}

type fmtStringerWrapper struct {
	s fmt.Stringer
}

func (w fmtStringerWrapper) TextValue() (Text, error) {
	return Text{String: w.s.String(), Valid: true}, nil
}

type byte16Wrapper [16]byte

func (w *byte16Wrapper) ScanUUID(v UUID) error {
	if !v.Valid {
		return fmt.Errorf("cannot scan NULL into *[16]byte")
	}
	*w = byte16Wrapper(v.Bytes)
	return nil
}

func (w byte16Wrapper) UUIDValue() (UUID, error) {
	return UUID{Bytes: [16]byte(w), Valid: true}, nil
}

type byteSliceWrapper []byte

func (w byteSliceWrapper) SkipUnderlyingTypePlan() {}

func (w *byteSliceWrapper) ScanText(v Text) error {
	if !v.Valid {
		*w = nil
		return nil
	}

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/builtin_wrappers.go:659 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/a499e26005ae1c19.json. Report an issue: GitHub.