{"record":{"id":"8f8bf64b339d9a92","repo":"prestodb/presto","slug":"hive-table-dropped-during-query","errorCode":"HIVE_TABLE_DROPPED_DURING_QUERY","errorMessage":"The metastore delete operation failed: ","messagePattern":"The metastore delete operation failed: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java","lineNumber":1774,"sourceCode":"                    logCleanupFailure(throwable, \"failed to rollback: %s\", operation.getDescription());\n                }\n            }\n        }\n\n        private void executeMetastoreDeleteOperations()\n        {\n            List<String> failedDeletionDescriptions = new ArrayList<>();\n            List<Throwable> suppressedExceptions = new ArrayList<>();\n            boolean anySucceeded = false;\n            ErrorCodeSupplier errorCode = HIVE_METASTORE_ERROR;\n            for (IrreversibleMetastoreOperation deleteOperation : metastoreDeleteOperations) {\n                try {\n                    deleteOperation.run();\n                    anySucceeded = true;\n                }\n                catch (Throwable t) {\n                    if (metastoreDeleteOperations.size() == 1 && t instanceof TableNotFoundException) {\n                        throw new PrestoException(HIVE_TABLE_DROPPED_DURING_QUERY,\n                                \"The metastore delete operation failed: \" + deleteOperation.getDescription());\n                    }\n                    if (t instanceof PrestoException) {\n                        if (((PrestoException) t).getErrorCode().getType() == USER_ERROR) {\n                            errorCode = HIVE_METASTORE_USER_ERROR;\n                        }\n                    }\n                    failedDeletionDescriptions.add(deleteOperation.getDescription());\n                    // A limit is needed to avoid having a huge exception object. 5 was chosen arbitrarily.\n                    if (suppressedExceptions.size() < 5) {\n                        suppressedExceptions.add(t);\n                    }\n                }\n            }\n            if (!suppressedExceptions.isEmpty()) {\n                StringBuilder message = new StringBuilder();\n                if (deleteOnly && !anySucceeded) {\n                    message.append(\"The following metastore delete operations failed: \");","sourceCodeStart":1756,"sourceCodeEnd":1792,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java#L1756-L1792","documentation":"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.","triggerScenarios":"Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java:1774 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the full message and suppressed exceptions to identify which metastore deletes failed","Manually clean up leftover partitions/tables in the metastore listed in the failure descriptions","Check metastore connectivity/permissions; once resolved, the failed operations may be re-run idempotently"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}