prestodb/presto · error · SemanticException

MISSING_TABLE

MISSING_TABLE

Error message

Table '%s' does not exist

What it means

TruncateTableTask validates the target before truncating; this fires when the qualified table name does not resolve to an existing table in the metastore (and IF EXISTS was not given), raising MISSING_TABLE.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/TruncateTableTask.java:72

        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);
        }

        accessControl.checkCanTruncateTable(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);

        metadata.truncateTable(session, tableHandle.get());

        return immediateFuture(null);
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the table name and its schema qualification with SHOW TABLES
  2. Confirm the table was not dropped or renamed concurrently
  3. Create the table before truncating it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/TruncateTableTask.java:72 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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