prestodb/presto · error · PrestoException

HIVE_TABLE_DROPPED_DURING_QUERY

HIVE_TABLE_DROPPED_DURING_QUERY

Error message

The metastore delete operation failed: 

What it means

executeMetastoreDeleteOperations collects descriptions of every metastore delete operation that failed during commit/rollback; if any deletion failed, a HiveMetastoreError PrestoException is thrown with this message plus the concatenated descriptions, and other failures attached as suppressed exceptions. It signals partial failure of irreversible metastore cleanup.

Solutions

  1. Read the full message and suppressed exceptions to identify which metastore deletes failed
  2. Manually clean up leftover partitions/tables in the metastore listed in the failure descriptions
  3. Check metastore connectivity/permissions; once resolved, the failed operations may be re-run idempotently
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java:1774 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/8f8bf64b339d9a92. Report an issue: GitHub.

Appendix: source

Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java:1774

                    logCleanupFailure(throwable, "failed to rollback: %s", operation.getDescription());
                }
            }
        }

        private void executeMetastoreDeleteOperations()
        {
            List<String> failedDeletionDescriptions = new ArrayList<>();
            List<Throwable> suppressedExceptions = new ArrayList<>();
            boolean anySucceeded = false;
            ErrorCodeSupplier errorCode = HIVE_METASTORE_ERROR;
            for (IrreversibleMetastoreOperation deleteOperation : metastoreDeleteOperations) {
                try {
                    deleteOperation.run();
                    anySucceeded = true;
                }
                catch (Throwable t) {
                    if (metastoreDeleteOperations.size() == 1 && t instanceof TableNotFoundException) {
                        throw new PrestoException(HIVE_TABLE_DROPPED_DURING_QUERY,
                                "The metastore delete operation failed: " + deleteOperation.getDescription());
                    }
                    if (t instanceof PrestoException) {
                        if (((PrestoException) t).getErrorCode().getType() == USER_ERROR) {
                            errorCode = HIVE_METASTORE_USER_ERROR;
                        }
                    }
                    failedDeletionDescriptions.add(deleteOperation.getDescription());
                    // A limit is needed to avoid having a huge exception object. 5 was chosen arbitrarily.
                    if (suppressedExceptions.size() < 5) {
                        suppressedExceptions.add(t);
                    }
                }
            }
            if (!suppressedExceptions.isEmpty()) {
                StringBuilder message = new StringBuilder();
                if (deleteOnly && !anySucceeded) {
                    message.append("The following metastore delete operations failed: ");

View on GitHub (pinned to 55bb57d202)