prestodb/presto · error · SemanticException

MISSING_CATALOG

MISSING_CATALOG

Error message

Catalog '%s' does not exist

What it means

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.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/RenameSchemaTask.java:54

public class RenameSchemaTask
        implements DDLDefinitionTask<RenameSchema>
{
    @Override
    public String getName()
    {
        return "RENAME SCHEMA";
    }

    @Override
    public ListenableFuture<?> execute(RenameSchema statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)
    {
        CatalogSchemaName source = createCatalogSchemaName(session, statement, Optional.of(statement.getSource()), metadata);
        CatalogSchemaName target = new CatalogSchemaName(source.getCatalogName(), statement.getTarget().getValue());
        MetadataResolver metadataResolver = metadata.getMetadataResolver(session);

        if (!metadataResolver.catalogExists(source.getCatalogName())) {
            throw new SemanticException(MISSING_CATALOG, "Catalog '%s' does not exist", source.getCatalogName());
        }

        if (!metadataResolver.schemaExists(source)) {
            throw new SemanticException(MISSING_SCHEMA, statement, "Schema '%s' does not exist", source);
        }

        if (metadataResolver.schemaExists(target)) {
            throw new SemanticException(SCHEMA_ALREADY_EXISTS, statement, "Target schema '%s' already exists", target);
        }

        accessControl.checkCanRenameSchema(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), source, statement.getTarget().getValue());

        metadata.renameSchema(session, source, statement.getTarget().getValue());

        return immediateFuture(null);
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. List available catalogs with SHOW CATALOGS and correct the catalog qualifier
  2. Verify the catalog .properties file is deployed on the coordinator and restart if newly added
  3. Use the session's default catalog (USE catalog) so the statement doesn't need an explicit prefix
  4. Check environment: the target catalog may only exist in another cluster/environment

Example fix

-- before
ALTER SCHEMA sale.web RENAME TO web_archive; -- catalog 'sale' typo
-- after
ALTER SCHEMA sales.web RENAME TO web_archive;
Defensive patterns

Strategy: validation

Validate before calling

ResultSet rs = stmt.executeQuery("SHOW CATALOGS");
Set<String> catalogs = new HashSet<>();
while (rs.next()) catalogs.add(rs.getString(1));
if (!catalogs.contains("sales")) { /* abort: catalog not deployed */ }

Try / catch

try {
    execute("ALTER SCHEMA sales.web RENAME TO web_archive");
} catch (SemanticException e) {
    if (e.getCode() == MISSING_CATALOG) { /* wrong environment/catalog — fail fast with clear message */ }
    else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/8a1859fbaca8cccf. Report an issue: GitHub.