{"record":{"id":"62298c4e920443a7","repo":"t8y2/dbx","slug":"list-custom-types-in-schema-q-w-62298c","errorCode":null,"errorMessage":"list custom types in schema %q: %w","messagePattern":"list custom types in schema %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/vastbase-go/vastbase_metadata.go","lineNumber":1071,"sourceCode":"\t\trows, queryErr := s.metadataQuery(query)\n\t\tif queryErr == nil {\n\t\t\tfor rows.Next() {\n\t\t\t\tvar name, kind string\n\t\t\t\tvar comment sql.NullString\n\t\t\t\tif rows.Scan(&name, &kind, &comment) == nil {\n\t\t\t\t\tresult = append(result, objectInfo{Name: name, ObjectType: kind, Schema: effective, Comment: nullStringPtr(comment)})\n\t\t\t\t}\n\t\t\t}\n\t\t\t_ = rows.Close()\n\t\t}\n\t}\n\tif constraintsAllowTypes(constraints) {\n\t\ttypes, typesErr := s.listCustomTypes(effective)\n\t\tif typesErr != nil {\n\t\t\t// A type catalog failure is a real fault: surfacing it lets the user\n\t\t\t// distinguish an incomplete “all objects” view from an actually\n\t\t\t// empty schema, instead of silently dropping the type group.\n\t\t\treturn nil, fmt.Errorf(\"list custom types in schema %q: %w\", effective, typesErr)\n\t\t}\n\t\tresult = append(result, types...)\n\t}\n\tfiltered := result[:0]\n\tfor _, item := range result {\n\t\tif constraintsMatch(constraints, item.Name, item.ObjectType) {\n\t\t\tfiltered = append(filtered, item)\n\t\t}\n\t}\n\tsort.SliceStable(filtered, func(i, j int) bool {\n\t\tif objectOrder(filtered[i].ObjectType) != objectOrder(filtered[j].ObjectType) {\n\t\t\treturn objectOrder(filtered[i].ObjectType) < objectOrder(filtered[j].ObjectType)\n\t\t}\n\t\treturn filtered[i].Name < filtered[j].Name\n\t})\n\treturn pageObjects(filtered, constraints), nil\n}\n","sourceCodeStart":1053,"sourceCodeEnd":1089,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/vastbase-go/vastbase_metadata.go#L1053-L1089","documentation":"When listing all objects in a schema, if the custom-type enumeration (listCustomTypes) fails, the driver returns this wrapped error instead of silently omitting types. The comment in the source explains the intent: a type-catalog failure must be distinguishable from an actually empty type group, so the caller sees a real fault.","triggerScenarios":"Calling the list-schema-objects API with constraints that allow types (constraintsAllowTypes true) while listCustomTypes fails — e.g. catalog permission errors, connection drops, or catalog query incompatibilities during custom type enumeration.","commonSituations":"Schema-wide introspection with a restricted role; unstable connections during large schema scans; wrong catalog mode for the server version.","solutions":["Inspect the wrapped cause (%w) to find whether it's permissions, connectivity, or a query error.","Grant catalog SELECT privileges to the introspection user so custom type enumeration succeeds.","Retry the listing if the cause is transient (network).","If you genuinely need to skip types on failure, wrap/handle at a layer above rather than modifying driver behavior.","Verify the catalog mode setting matches the server."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if err := db.Ping(); err != nil { return err }\nif _, err := db.Query(\"SELECT 1 FROM pg_type LIMIT 1\"); err != nil {\n    return fmt.Errorf(\"catalog type access missing: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"objects, err := srv.ListSchemaObjects(schema, constraints)\nif err != nil {\n    var typeErr error\n    if errors.As(err, &typeErr) && strings.Contains(err.Error(), \"list custom types\") {\n        log.Printf(\"type group incomplete for %s: %v\", schema, err)\n    }\n    return err // do not treat as empty schema\n}","preventionTips":["Don't conflate this error with an empty schema — always inspect the cause.","Grant catalog read privileges before schema-wide scans.","Preflight connectivity checks on long-running introspection."],"tags":["vastbase","metadata","schema-introspection"],"backgroundTag":"metadata-query-failed","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}