{"id":"a39459415b2b3a1e","repo":"jackc/pgx","slug":"unknown-field-for-composite-type-q-field-q-oi","errorCode":null,"errorMessage":"Unknown field for composite type %q:  field %q (OID %v) is not already registered.","messagePattern":"Unknown field for composite type %q:  field %q \\(OID (.+?)\\) is not already registered\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"derived_types.go","lineNumber":204,"sourceCode":"\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}\n\n\t\t\ttype_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: &pgtype.CompositeCodec{Fields: fields}}\n\t\tcase \"d\": // domain\n\t\t\tdt, ok := m.TypeForOID(ti.Typbasetype)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Domain base type OID %v was not already registered, needed for %q\", ti.Typbasetype, ti.TypeName)\n\t\t\t}\n\n\t\t\ttype_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: dt.Codec}\n\t\tcase \"e\": // enum\n\t\t\ttype_ = &pgtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: &pgtype.EnumCodec{}}\n\t\tcase \"r\": // range\n\t\t\tdt, ok := m.TypeForOID(ti.Rngsubtype)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Range element OID %v was not already registered, needed for %q\", ti.Rngsubtype, ti.TypeName)","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/derived_types.go#L186-L222","documentation":"Error \"Unknown field for composite type %q:  field %q (OID %v) is not already registered.\" thrown in jackc/pgx.","triggerScenarios":"Thrown at derived_types.go:204 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}