prestodb/presto · error · SemanticException
MISSING_CATALOG
MISSING_CATALOG
Error message
Catalog '%s' does not exist
What it means
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.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/TruncateTableTask.java:55
import static com.google.common.util.concurrent.Futures.immediateFuture;
public class TruncateTableTask
implements DDLDefinitionTask<TruncateTable>
{
@Override
public String getName()
{
return "TRUNCATE TABLE";
}
@Override
public ListenableFuture<?> execute(TruncateTable statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)
{
MetadataResolver metadataResolver = metadata.getMetadataResolver(session);
QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getTableName(), metadata);
if (!metadataResolver.catalogExists(tableName.getCatalogName())) {
throw new SemanticException(MISSING_CATALOG, "Catalog '%s' does not exist", tableName.getCatalogName());
}
if (!metadataResolver.schemaExists(tableName.getCatalogSchemaName())) {
throw new SemanticException(MISSING_SCHEMA, statement, "Schema '%s' does not exist", tableName.getSchemaName());
}
if (metadataResolver.isMaterializedView(tableName)) {
throw new SemanticException(NOT_SUPPORTED, statement, "Cannot truncate a materialized view");
}
if (metadataResolver.isView(tableName)) {
throw new SemanticException(NOT_SUPPORTED, statement, "Cannot truncate a view");
}
Optional<TableHandle> tableHandle = metadata.getMetadataResolver(session).getTableHandle(tableName);
if (!tableHandle.isPresent()) {
throw new SemanticException(MISSING_TABLE, statement, "Table '%s' does not exist", tableName);
}View on GitHub (pinned to 55bb57d202)
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.
Example fix
-- before TRUNCATE TABLE prodhive.db.events; -- after TRUNCATE TABLE hive.db.events;
Defensive patterns
Strategy: validation
Validate before calling
// before TRUNCATE SELECT * FROM system.metadata.catalogs WHERE catalog_name = 'hive';
Try / catch
// catch SemanticException/PrestoException with code MISSING_CATALOG; correct the catalog name or register the connector and retry
Prevention
- Run SHOW CATALOGS to confirm names before scripting
- Keep connector properties in sync across environments
- Fully qualify table names with a verified catalog
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/b569604b9f1eca58.
Report an issue: GitHub.