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/tsvector.go:59

}

func (t TSVector) String() string {
	buf, _ := encodePlanTSVectorCodecText{}.Encode(t, nil)
	return string(buf)
}

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

	if src, ok := src.(string); ok {
		return scanPlanTextAnyToTSVectorScanner{}.scanString(src, t)
	}

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

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

	buf, err := TSVectorCodec{}.PlanEncode(nil, 0, TextFormatCode, t).Encode(t, nil)
	if err != nil {
		return nil, err
	}

	return string(buf), nil
}

// TSVectorWeight represents the weight label of a lexeme position in a tsvector.
type TSVectorWeight byte

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/tsvector.go:59 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/7c8eef9b2544f452.json. Report an issue: GitHub.