{"record":{"id":"b569604b9f1eca58","repo":"prestodb/presto","slug":"missing-catalog-b56960","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/TruncateTableTask.java","lineNumber":55,"sourceCode":"import static com.google.common.util.concurrent.Futures.immediateFuture;\n\npublic class TruncateTableTask\n        implements DDLDefinitionTask<TruncateTable>\n{\n    @Override\n    public String getName()\n    {\n        return \"TRUNCATE TABLE\";\n    }\n\n    @Override\n    public ListenableFuture<?> execute(TruncateTable statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        MetadataResolver metadataResolver = metadata.getMetadataResolver(session);\n        QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getTableName(), metadata);\n\n        if (!metadataResolver.catalogExists(tableName.getCatalogName())) {\n            throw new SemanticException(MISSING_CATALOG, \"Catalog '%s' does not exist\", tableName.getCatalogName());\n        }\n\n        if (!metadataResolver.schemaExists(tableName.getCatalogSchemaName())) {\n            throw new SemanticException(MISSING_SCHEMA, statement, \"Schema '%s' does not exist\", tableName.getSchemaName());\n        }\n\n        if (metadataResolver.isMaterializedView(tableName)) {\n            throw new SemanticException(NOT_SUPPORTED, statement, \"Cannot truncate a materialized view\");\n        }\n\n        if (metadataResolver.isView(tableName)) {\n            throw new SemanticException(NOT_SUPPORTED, statement, \"Cannot truncate a view\");\n        }\n\n        Optional<TableHandle> tableHandle = metadata.getMetadataResolver(session).getTableHandle(tableName);\n        if (!tableHandle.isPresent()) {\n            throw new SemanticException(MISSING_TABLE, statement, \"Table '%s' does not exist\", tableName);\n        }","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/TruncateTableTask.java#L37-L73","documentation":"SemanticException (MISSING_CATALOG) from TruncateTableTask.execute: the catalog portion of the TRUNCATE TABLE target name is not registered with the coordinator, so the table lookup cannot proceed to schema/table resolution.","triggerScenarios":"Executing TRUNCATE TABLE catalog.schema.table where catalogExists(catalogName) returns false — the catalog name in the statement (or the session's default catalog) is not registered on the coordinator.","commonSituations":"Typos in the catalog name, missing/renamed connector in catalog properties, connecting with a session default catalog that isn't configured, environment drift between dev and prod.","solutions":["Correct the catalog name in the statement (SHOW CATALOGS to list valid ones).","Deploy/fix the connector properties file for the catalog on the coordinator.","Set the session's default catalog to an existing one, or always fully qualify the table name.","Restart/reload the server if a newly added catalog isn't picked up."],"exampleFix":"-- before\nTRUNCATE TABLE prodhive.db.events;\n-- after\nTRUNCATE TABLE hive.db.events;","handlingStrategy":"validation","validationCode":"// before TRUNCATE\nSELECT * FROM system.metadata.catalogs WHERE catalog_name = 'hive';","typeGuard":null,"tryCatchPattern":"// catch SemanticException/PrestoException with code MISSING_CATALOG; correct the catalog name or register the connector and retry","preventionTips":["Run SHOW CATALOGS to confirm names before scripting","Keep connector properties in sync across environments","Fully qualify table names with a verified catalog"],"tags":["sql","catalog","missing-object"],"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"}