{"record":{"id":"6f102cfbc2373f6c","repo":"prestodb/presto","slug":"missing-catalog-6f102c","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/DropSchemaTask.java","lineNumber":64,"sourceCode":"\n    @Override\n    public String explain(DropSchema statement, List<Expression> parameters)\n    {\n        return \"DROP SCHEMA \" + statement.getSchemaName();\n    }\n\n    @Override\n    public ListenableFuture<?> execute(DropSchema statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        if (statement.isCascade()) {\n            throw new PrestoException(NOT_SUPPORTED, \"CASCADE is not yet supported for DROP SCHEMA\");\n        }\n\n        CatalogSchemaName schema = createCatalogSchemaName(session, statement, Optional.of(statement.getSchemaName()), metadata);\n        MetadataResolver metadataResolver = metadata.getMetadataResolver(session);\n\n        if (!metadataResolver.catalogExists(schema.getCatalogName())) {\n            throw new SemanticException(MISSING_CATALOG, \"Catalog '%s' does not exist\", schema.getCatalogName());\n        }\n\n        if (!metadataResolver.schemaExists(schema)) {\n            if (!statement.isExists()) {\n                throw new SemanticException(MISSING_SCHEMA, statement, \"Schema '%s' does not exist\", schema);\n            }\n            return immediateFuture(null);\n        }\n\n        accessControl.checkCanDropSchema(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), schema);\n\n        metadata.dropSchema(session, schema);\n\n        return immediateFuture(null);\n    }\n}\n","sourceCodeStart":46,"sourceCodeEnd":81,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/DropSchemaTask.java#L46-L81","documentation":"Thrown by DropSchemaTask.execute when the catalog part of the qualified schema name does not exist in the server. This SemanticException fires before schema existence is evaluated, so a wrong catalog always reports MISSING_CATALOG rather than MISSING_SCHEMA.","triggerScenarios":"metadataResolver.catalogExists(schema.getCatalogName()) returns false for the catalog parsed from the DROP SCHEMA target, regardless of IF EXISTS.","commonSituations":"Typo in catalog name; connector plugin not deployed/restarted so catalog missing; catalog property file removed or misconfigured; environment differences (dev vs prod catalog names).","solutions":["List available catalogs: SHOW CATALOGS, and correct the catalog prefix in the statement.","Check etc/catalog/*.properties on the coordinator — deploy the missing connector and restart.","If IF EXISTS was expected to suppress this, note catalog-level checks throw regardless; fix the name instead."],"exampleFix":"// before\nDROP SCHEMA hivee.default.web_logs;\n// after\nDROP SCHEMA hive.default.web_logs;","handlingStrategy":"validation","validationCode":"-- verify catalog exists before DDL\nSHOW CATALOGS;\n-- or client-side: SELECT * FROM system.metadata.catalogs WHERE catalog_name = 'hive';","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate catalog names against SHOW CATALOGS in deployment scripts.","Ensure connector .properties files are provisioned on all coordinators before running DDL.","Pin catalog names in config rather than deriving them from environment variables without checks."],"tags":["sql","catalog","configuration"],"backgroundTag":"catalog-does-not-exist","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"}