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/hstore.go:46

}

// HstoreValue implements the [HstoreValuer] interface.
func (h Hstore) HstoreValue() (Hstore, error) {
	return h, nil
}

// Scan implements the [database/sql.Scanner] interface.
func (h *Hstore) Scan(src any) error {
	if src == nil {
		*h = nil
		return nil
	}

	if src, ok := src.(string); ok {
		return scanPlanTextAnyToHstoreScanner{}.scanString(src, h)
	}

	return fmt.Errorf("cannot scan %T", src)
}

// Value implements the [database/sql/driver.Valuer] interface.
func (h Hstore) Value() (driver.Value, error) {
	if h == nil {
		return nil, nil
	}

	buf, err := HstoreCodec{}.PlanEncode(nil, 0, TextFormatCode, h).Encode(h, nil)
	if err != nil {
		return nil, err
	}
	return string(buf), err
}

type HstoreCodec struct{}

func (HstoreCodec) FormatSupported(format int16) bool {

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/hstore.go:46 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/68c6d422b0da7c30.json. Report an issue: GitHub.