{"record":{"id":"a7917578f9d3d212","repo":"apache/seatunnel","slug":"failed-to-drop-table-s-in-catalog-s","errorCode":null,"errorMessage":"Failed to drop table %s in catalog %s","messagePattern":"Failed to drop table (.+?) in catalog (.+?)","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/catalog/ElasticSearchCatalog.java","lineNumber":207,"sourceCode":"            return;\n        }\n        esRestClient.createIndex(tablePath.getTableName());\n    }\n\n    @Override\n    public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)\n            throws TableNotExistException, CatalogException {\n        checkNotNull(tablePath);\n        if (!tableExists(tablePath)) {\n            if (!ignoreIfNotExists) {\n                throw new TableNotExistException(catalogName, tablePath);\n            }\n            return;\n        }\n        try {\n            esRestClient.dropIndex(tablePath.getTableName());\n        } catch (Exception ex) {\n            throw new CatalogException(\n                    String.format(\n                            \"Failed to drop table %s in catalog %s\",\n                            tablePath.getTableName(), catalogName),\n                    ex);\n        }\n    }\n\n    @Override\n    public void createDatabase(TablePath tablePath, boolean ignoreIfExists)\n            throws DatabaseAlreadyExistException, CatalogException {\n        try {\n            createTable(tablePath, null, ignoreIfExists);\n        } catch (TableAlreadyExistException ex) {\n            throw new DatabaseAlreadyExistException(catalogName, tablePath.getDatabaseName());\n        }\n    }\n\n    @Override","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/catalog/ElasticSearchCatalog.java#L189-L225","documentation":"ElasticSearchCatalog.dropTable wraps any exception raised while deleting an index via esRestClient.dropIndex into a CatalogException with this message. It signals that the catalog could not remove the table (index) named in the message from the Elasticsearch cluster identified by catalogName. The original cause is attached, so the underlying reason ( connectivity, missing index, auth) is in the exception chain.","triggerScenarios":"Calling ElasticSearchCatalog.dropTable(TablePath) (directly or via dropDatabase/testCatalog) when esRestClient.dropIndex throws: Elasticsearch unreachable, index missing, insufficient permissions, or a non-2xx DELETE response.","commonSituations":"Elasticsearch node down or wrong host/port in catalog options; table path points to a nonexistent index; user lacks delete-index privileges; network timeout between SeaTunnel and the cluster; cluster in read-only mode.","solutions":["Check the chained cause (ex) to find the root reason — usually a ResponseException with the ES status code","Verify Elasticsearch connectivity (host, port, credentials) with curl or the catalog testConnection","Confirm the index exists: GET /<index-name>; use ifExists/exists checks before dropping","Ensure the configured user has delete privileges on the index","Retry after the cluster recovers if the cause was a timeout or 5xx"],"exampleFix":"// before\ncatalog.dropTable(tablePath); // throws CatalogException if index missing\n// after\nif (catalog.tableExists(tablePath)) {\n    catalog.dropTable(tablePath);\n}","handlingStrategy":"try-catch","validationCode":"if (catalog.tableExists(tablePath)) { catalog.dropTable(tablePath); }","typeGuard":null,"tryCatchPattern":"try { catalog.dropTable(tablePath); } catch (CatalogException e) { LOG.error(\"dropTable failed for \" + tablePath + \", cause: \" + e.getCause(), e); }","preventionTips":["Check tableExists before dropping","Validate ES connectivity with testConnection during job setup","Grant the configured user delete-index privileges","Always inspect the chained cause for the ES status code"],"tags":["elasticsearch","catalog","drop-table","http-error-response"],"backgroundTag":"database-write-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}