{"record":{"id":"8a1859fbaca8cccf","repo":"prestodb/presto","slug":"missing-catalog-8a1859","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/execution/RenameSchemaTask.java","lineNumber":54,"sourceCode":"\npublic class RenameSchemaTask\n        implements DDLDefinitionTask<RenameSchema>\n{\n    @Override\n    public String getName()\n    {\n        return \"RENAME SCHEMA\";\n    }\n\n    @Override\n    public ListenableFuture<?> execute(RenameSchema statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        CatalogSchemaName source = createCatalogSchemaName(session, statement, Optional.of(statement.getSource()), metadata);\n        CatalogSchemaName target = new CatalogSchemaName(source.getCatalogName(), statement.getTarget().getValue());\n        MetadataResolver metadataResolver = metadata.getMetadataResolver(session);\n\n        if (!metadataResolver.catalogExists(source.getCatalogName())) {\n            throw new SemanticException(MISSING_CATALOG, \"Catalog '%s' does not exist\", source.getCatalogName());\n        }\n\n        if (!metadataResolver.schemaExists(source)) {\n            throw new SemanticException(MISSING_SCHEMA, statement, \"Schema '%s' does not exist\", source);\n        }\n\n        if (metadataResolver.schemaExists(target)) {\n            throw new SemanticException(SCHEMA_ALREADY_EXISTS, statement, \"Target schema '%s' already exists\", target);\n        }\n\n        accessControl.checkCanRenameSchema(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), source, statement.getTarget().getValue());\n\n        metadata.renameSchema(session, source, statement.getTarget().getValue());\n\n        return immediateFuture(null);\n    }\n}\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/RenameSchemaTask.java#L36-L72","documentation":"SemanticException thrown by RenameSchemaTask when the catalog part of the source schema name does not exist. Presto validates catalog existence via metadataResolver.catalogExists before touching schemas; an unknown catalog means the rename cannot proceed. This is caught before the more specific schema check.","triggerScenarios":"ALTER SCHEMA source.rename ... where catalogExists(source.getCatalogName()) is false — the catalog prefix in the qualified name isn't a deployed catalog in this Presto cluster.","commonSituations":"Typo in catalog name; catalog property file missing/renamed on the coordinator; connecting to a cluster that doesn't mount the expected connector; environment mismatch (cluster lacks the catalog).","solutions":["List available catalogs with SHOW CATALOGS and correct the catalog qualifier","Verify the catalog .properties file is deployed on the coordinator and restart if newly added","Use the session's default catalog (USE catalog) so the statement doesn't need an explicit prefix","Check environment: the target catalog may only exist in another cluster/environment"],"exampleFix":"-- before\nALTER SCHEMA sale.web RENAME TO web_archive; -- catalog 'sale' typo\n-- after\nALTER SCHEMA sales.web RENAME TO web_archive;","handlingStrategy":"validation","validationCode":"ResultSet rs = stmt.executeQuery(\"SHOW CATALOGS\");\nSet<String> catalogs = new HashSet<>();\nwhile (rs.next()) catalogs.add(rs.getString(1));\nif (!catalogs.contains(\"sales\")) { /* abort: catalog not deployed */ }","typeGuard":null,"tryCatchPattern":"try {\n    execute(\"ALTER SCHEMA sales.web RENAME TO web_archive\");\n} catch (SemanticException e) {\n    if (e.getCode() == MISSING_CATALOG) { /* wrong environment/catalog — fail fast with clear message */ }\n    else throw e;\n}","preventionTips":["Run SHOW CATALOGS to confirm catalog deployment before DDL","Ensure catalog .properties files are deployed to all coordinators","Avoid hardcoding catalog names; parameterize per environment"],"tags":["presto","ddl","missing-catalog","sql"],"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"}