{"id":"83e754047e41d8b1","repo":"jackc/pgx","slug":"while-scanning-type-information-w","errorCode":null,"errorMessage":"While scanning type information: %w","messagePattern":"While scanning type information: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"derived_types.go","lineNumber":189,"sourceCode":"\tif len(typeNames) == 0 {\n\t\treturn nil, fmt.Errorf(\"No type names were supplied.\")\n\t}\n\n\t// Disregard server version errors. This will result in\n\t// the SQL not support recent structures such as multirange\n\tserverVersion, _ := serverVersion(c)\n\tsql := buildLoadDerivedTypesSQL(serverVersion, typeNames)\n\trows, err := c.Query(ctx, sql, QueryResultFormats{TextFormatCode}, typeNames)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"While generating load types query: %w\", err)\n\t}\n\tdefer rows.Close()\n\tresult := make([]*pgtype.Type, 0, 100)\n\tfor rows.Next() {\n\t\tti := derivedTypeInfo{}\n\t\terr = rows.Scan(&ti.TypeName, &ti.NspName, &ti.Typtype, &ti.Typbasetype, &ti.Typelem, &ti.Oid, &ti.Rngtypid, &ti.Rngsubtype, &ti.Attnames, &ti.Atttypids)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"While scanning type information: %w\", err)\n\t\t}\n\t\tvar type_ *pgtype.Type\n\t\tswitch ti.Typtype {\n\t\tcase \"b\": // array\n\t\t\tdt, ok := m.TypeForOID(ti.Typelem)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Array element OID %v not registered while loading pgtype %q\", ti.Typelem, ti.TypeName)\n\t\t\t}\n\t\t\ttype_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: &pgtype.ArrayCodec{ElementType: dt}}\n\t\tcase \"c\": // composite\n\t\t\tvar fields []pgtype.CompositeCodecField\n\t\t\tfor i, fieldName := range ti.Attnames {\n\t\t\t\tdt, ok := m.TypeForOID(ti.Atttypids[i])\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Unknown field for composite type %q:  field %q (OID %v) is not already registered.\", ti.TypeName, fieldName, ti.Atttypids[i])\n\t\t\t\t}\n\t\t\t\tfields = append(fields, pgtype.CompositeCodecField{Name: fieldName, Type: dt})\n\t\t\t}","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/derived_types.go#L171-L207","documentation":"Error \"While scanning type information: %w\" thrown in jackc/pgx.","triggerScenarios":"Thrown at derived_types.go:189 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}