{"record":{"id":"19b92beaa060ab83","repo":"t8y2/dbx","slug":"failed-to-locate-custom-type-s-s-w-19b92b","errorCode":null,"errorMessage":"failed to locate custom type %s.%s: %w","messagePattern":"failed to locate custom type (.+?)\\.(.+?): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/vastbase-go/vastbase_metadata.go","lineNumber":613,"sourceCode":"\t}\n\tschema = strings.TrimSpace(schema)\n\tname = strings.TrimSpace(name)\n\tif schema == \"\" || name == \"\" {\n\t\treturn nil, errors.New(\"schema and type name are required\")\n\t}\n\tif isSystemSchema(schema) {\n\t\treturn nil, fmt.Errorf(\"system schema %s is not supported for custom type details\", schema)\n\t}\n\tcatalog := \"sys_catalog\"\n\tif s.mode.postgresCatalog {\n\t\tcatalog = \"pg_catalog\"\n\t}\n\tprefix := catalogPrefix(catalog)\n\tqueries := customTypeCatalogQueriesFor(catalog, prefix, schema, name)\n\n\trows, err := s.metadataQuery(queries.general)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to locate custom type %s.%s: %w\", schema, name, err)\n\t}\n\tdefer rows.Close()\n\tif !rows.Next() {\n\t\tif err := rows.Err(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read type %s.%s: %w\", schema, name, err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"custom type %s.%s does not exist\", schema, name)\n\t}\n\tvar oid, typbasetype, typrelid, typelem, typcollation int64\n\tvar typtype, typalign, typstorage string\n\tvar typisdefined, typnotnull, typbyval bool\n\tvar typdefaultbin, typdefault, inputFn, outputFn, receiveFn, sendFn, analyzeFn, comment, collname, relkind sql.NullString\n\tvar typlen sql.NullInt64\n\tvar typtypmod int64\n\tif err := rows.Scan(&oid, &typtype, &typisdefined, &typbasetype, &typnotnull, &typrelid, &typelem, &typcollation, &typdefaultbin, &typdefault, &typlen, &typbyval, &typalign, &typstorage, &typtypmod, &inputFn, &outputFn, &receiveFn, &sendFn, &analyzeFn, &comment, &relkind, &collname); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read type %s.%s: %w\", schema, name, err)\n\t}\n\tif err := rows.Close(); err != nil {","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/vastbase-go/vastbase_metadata.go#L595-L631","documentation":"This wraps any error returned while executing the general catalog query that locates the custom type row in sys_catalog/pg_catalog (vastbase_metadata.go:611-613). The driver found the type lookup SQL failed — the type itself may or may not exist; the failure is at query execution time, not a 'not found' result.","triggerScenarios":"Calling get_type_details when the underlying metadataQuery for queries.general fails: connection dropped or closed mid-call, insufficient privileges to read catalog tables, catalog tables missing/renamed on an incompatible server version, or SQL syntax the server rejects (e.g. features like multirange columns absent in older Vastbase).","commonSituations":"Server connection terminated by idle timeout or network blip; read-only/limited role lacking SELECT on system catalogs; connecting the driver to a server variant whose catalog layout differs from what the queries assume.","solutions":["Reconnect and retry: verify the connection is alive (db.PingContext) before calling get_type_details.","Grant the connecting role SELECT privileges on the relevant system catalog tables.","Check the wrapped error (%w) for the root cause — version-specific SQL errors may require upgrading the driver or enabling the correct catalog mode (pg_catalog vs sys_catalog).","Confirm you are connecting to a Vastbase/Postgres-compatible server matching the driver's supported versions, not an incompatible fork."],"exampleFix":"// before\nrows, err := s.metadataQuery(queries.general) // err: connection reset\n// after\nif err := s.db.PingContext(ctx); err != nil {\n    if err := s.reconnect(); err != nil { return nil, err }\n}\nrows, err := s.metadataQuery(queries.general)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["database","metadata","query-failed","catalog"],"backgroundTag":"catalog-query-failed","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}