jackc/pgx · error

cannot scan %T

Error message

cannot scan %T

What it means

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

Source

Thrown at pgtype/uint32.go:57

func (dst *Uint32) Scan(src any) error {
	if src == nil {
		*dst = Uint32{}
		return nil
	}

	var n int64

	switch src := src.(type) {
	case int64:
		n = src
	case string:
		un, err := strconv.ParseUint(src, 10, 32)
		if err != nil {
			return err
		}
		n = int64(un)
	default:
		return fmt.Errorf("cannot scan %T", src)
	}

	if n < 0 {
		return fmt.Errorf("%d is less than the minimum value for Uint32", n)
	}
	if n > math.MaxUint32 {
		return fmt.Errorf("%d is greater than maximum value for Uint32", n)
	}

	*dst = Uint32{Uint32: uint32(n), Valid: true}

	return nil
}

// Value implements the [database/sql/driver.Valuer] interface.
func (src Uint32) Value() (driver.Value, error) {
	if !src.Valid {
		return nil, nil

View on GitHub (pinned to ec1a0befd2)

When it happens

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