{"record":{"id":"d9b55b55f0b3e657","repo":"prestodb/presto","slug":"missing-catalog-d9b55b","errorCode":"MISSING_CATALOG","errorMessage":"Catalog %s does not exist","messagePattern":"Catalog (.+?) does not exist","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/util/MetadataUtils.java","lineNumber":87,"sourceCode":"    {\n        if (metadataHandle.isPreProcessMetadataCalls()) {\n            return metadataHandle.getMaterializedViewDefinition(viewName);\n        }\n\n        return session.getRuntimeStats().recordWallTime(\n                GET_MATERIALIZED_VIEW_TIME_NANOS,\n                () -> metadataResolver.getMaterializedView(viewName));\n    }\n\n    public static TableColumnMetadata getTableColumnMetadata(Session session, MetadataResolver metadataResolver, QualifiedObjectName tableName)\n    {\n        Optional<TableHandle> tableHandle = session.getRuntimeStats().recordWallTime(\n                GET_TABLE_HANDLE_TIME_NANOS,\n                () -> metadataResolver.getTableHandle(tableName));\n\n        if (!tableHandle.isPresent()) {\n            if (!metadataResolver.catalogExists(tableName.getCatalogName())) {\n                throw new SemanticException(MISSING_CATALOG, \"Catalog %s does not exist\", tableName.getCatalogName());\n            }\n            if (!metadataResolver.schemaExists(new CatalogSchemaName(tableName.getCatalogName(), tableName.getSchemaName()))) {\n                throw new SemanticException(MISSING_SCHEMA, \"Schema %s does not exist\", tableName.getSchemaName());\n            }\n            throw new SemanticException(MISSING_TABLE, \"Table %s does not exist\", tableName);\n        }\n\n        Map<String, ColumnHandle> columnHandles = session.getRuntimeStats().recordWallTime(\n                GET_COLUMN_HANDLE_TIME_NANOS,\n                () -> metadataResolver.getColumnHandles(tableHandle.get()));\n\n        List<ColumnMetadata> columnsMetadata = session.getRuntimeStats().recordWallTime(\n                GET_COLUMN_METADATA_TIME_NANOS,\n                () -> metadataResolver.getColumns(tableHandle.get()));\n\n        return new TableColumnMetadata(tableHandle, columnHandles, columnsMetadata);\n    }\n}","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/util/MetadataUtils.java#L69-L105","documentation":"MetadataUtils.getTableColumnMetadata resolves a table via the connector's metadata resolver. If no TableHandle is returned, it distinguishes why: when the catalog itself does not exist it throws SemanticException MISSING_CATALOG, naming the missing catalog. This gives precise diagnostics before falling through to schema/table checks.","triggerScenarios":"Querying or fetching column metadata for a fully qualified table name whose catalog prefix is not registered, e.g. SELECT * FROM myschema.mytable where 'myschema' is being treated as a nonexistent catalog, or SHOW COLUMNS FROM badcatalog.s.t.","commonSituations":"Typo in catalog name; catalog connector not configured in etc/catalog/*.properties; connector failed to load at startup; using a two-part name that resolves catalog incorrectly.","solutions":["Verify the catalog exists: SHOW CATALOGS, and check etc/catalog/<name>.properties on the coordinator","Correct the catalog name in the query","Add/configure the missing connector catalog and restart the server","Fully qualify the table as catalog.schema.table"],"exampleFix":"// before\nSELECT * FROM prod-db.sales.orders; -- catalog 'prod-db' not configured\n// after\nSELECT * FROM postgresql.sales.orders; -- catalog 'postgresql' configured in etc/catalog/postgresql.properties","handlingStrategy":"try-catch","validationCode":"// Check catalog existence before resolving table metadata\nif (!metadata.listCatalogs(session).contains(tableName.getCatalogName())) {\n    throw new IllegalArgumentException(\"Catalog not found: \" + tableName.getCatalogName());\n}","typeGuard":null,"tryCatchPattern":"try {\n    columns = MetadataUtils.getTableColumnMetadata(...);\n} catch (SemanticException e) {\n    if (e.getCode() == MISSING_CATALOG) {\n        throw new UserError(\"Unknown catalog: check etc/catalog configuration\");\n    }\n    throw e;\n}","preventionTips":["Verify catalog config files exist in etc/catalog/ before deploying","Use SHOW CATALOGS to confirm registration","Fully qualify names as catalog.schema.table","Lint SQL against the list of configured catalogs in CI"],"tags":["catalog","metadata","missing","semantic"],"backgroundTag":"catalog-not-found","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}