jackc/pgx · error
cannot convert to sql.Scanner: cannot find registered type f
Error message
cannot convert to sql.Scanner: cannot find registered type for %T
What it means
Error "cannot convert to sql.Scanner: cannot find registered type for %T" thrown in jackc/pgx.
Source
Thrown at pgtype/pgtype.go:2022
// This uses the type of v to look up the PostgreSQL OID that v presumably came from. This means v must be registered
// with m by calling RegisterDefaultPgType.
func (m *Map) SQLScanner(v any) sql.Scanner {
if s, ok := v.(sql.Scanner); ok {
return s
}
return &sqlScannerWrapper{m: m, v: v}
}
type sqlScannerWrapper struct {
m *Map
v any
}
func (w *sqlScannerWrapper) Scan(src any) error {
t, ok := w.m.TypeForValue(w.v)
if !ok {
return fmt.Errorf("cannot convert to sql.Scanner: cannot find registered type for %T", w.v)
}
var bufSrc []byte
if src != nil {
switch src := src.(type) {
case string:
bufSrc = []byte(src)
case []byte:
bufSrc = src
default:
bufSrc = fmt.Append(nil, bufSrc)
}
}
return w.m.Scan(t.OID, TextFormatCode, bufSrc, w.v)
}
var valuerReflectType = reflect.TypeFor[driver.Valuer]()View on GitHub (pinned to ec1a0befd2)
When it happens
Trigger: Thrown at pgtype/pgtype.go:2022 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/96abbd0cd90ba106.json.
Report an issue: GitHub.