{"id":"96abbd0cd90ba106","repo":"jackc/pgx","slug":"cannot-convert-to-sql-scanner-cannot-find-registe","errorCode":null,"errorMessage":"cannot convert to sql.Scanner: cannot find registered type for %T","messagePattern":"cannot convert to sql\\.Scanner: cannot find registered type for %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/pgtype.go","lineNumber":2022,"sourceCode":"// This uses the type of v to look up the PostgreSQL OID that v presumably came from. This means v must be registered\n// with m by calling RegisterDefaultPgType.\nfunc (m *Map) SQLScanner(v any) sql.Scanner {\n\tif s, ok := v.(sql.Scanner); ok {\n\t\treturn s\n\t}\n\n\treturn &sqlScannerWrapper{m: m, v: v}\n}\n\ntype sqlScannerWrapper struct {\n\tm *Map\n\tv any\n}\n\nfunc (w *sqlScannerWrapper) Scan(src any) error {\n\tt, ok := w.m.TypeForValue(w.v)\n\tif !ok {\n\t\treturn fmt.Errorf(\"cannot convert to sql.Scanner: cannot find registered type for %T\", w.v)\n\t}\n\n\tvar bufSrc []byte\n\tif src != nil {\n\t\tswitch src := src.(type) {\n\t\tcase string:\n\t\t\tbufSrc = []byte(src)\n\t\tcase []byte:\n\t\t\tbufSrc = src\n\t\tdefault:\n\t\t\tbufSrc = fmt.Append(nil, bufSrc)\n\t\t}\n\t}\n\n\treturn w.m.Scan(t.OID, TextFormatCode, bufSrc, w.v)\n}\n\nvar valuerReflectType = reflect.TypeFor[driver.Valuer]()","sourceCodeStart":2004,"sourceCodeEnd":2040,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/pgtype.go#L2004-L2040","documentation":"Error \"cannot convert to sql.Scanner: cannot find registered type for %T\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/pgtype.go:2022 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}