{"record":{"id":"0d811b704ef77539","repo":"apache/cassandra","slug":"table-s-s-is-already-being-dropped","errorCode":null,"errorMessage":"Table '%s.%s' is already being dropped","messagePattern":"Table '(.+?)\\.(.+?)' is already being dropped","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/DropTableStatement.java","lineNumber":106,"sourceCode":"        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);\n\n        TableMetadata table = null == keyspace\n                            ? null\n                            : keyspace.getTableOrViewNullable(tableName);\n\n        if (null == table)\n        {\n            if (ifExists)\n                return schema;\n\n            throw ire(\"Table '%s.%s' doesn't exist\", keyspaceName, tableName);\n        }\n\n        if (table.isView())\n            throw ire(\"Cannot use DROP TABLE on a materialized view. Please use DROP MATERIALIZED VIEW instead.\");\n\n        if (table.requiresAccordSupport() && table.params.pendingDrop)\n            throw ire(\"Table '%s.%s' is already being dropped\", keyspaceName, tableName);\n\n        Iterable<ViewMetadata> views = keyspace.views.forTable(table.id);\n        if (!isEmpty(views))\n        {\n            throw ire(\"Cannot drop a table when materialized views still depend on it (%s)\",\n                      keyspaceName,\n                      join(\", \", transform(views, ViewMetadata::name)));\n        }\n\n        return schema.withAddedOrUpdated(keyspace.withSwapped(keyspace.tables.without(table)));\n    }\n\n    SchemaChange schemaChangeEvent(KeyspacesDiff diff)\n    {\n        return new SchemaChange(Change.DROPPED, Target.TABLE, keyspaceName, tableName);\n    }\n\n    public void authorize(ClientState client)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/DropTableStatement.java#L88-L124","documentation":"DROP TABLE was executed on a table that uses Accord-based transactional features and is already marked with a pending drop. Cassandra rejects the redundant drop to avoid a second, conflicting schema mutation on a table already being removed. It means the drop has already been committed or requested and is awaiting completion.","triggerScenarios":"Executing DROP TABLE (without IF EXISTS) twice against an Accord-enabled table whose TableParams.pendingDrop is still true because the first drop's schema change has not fully propagated/finished.","commonSituations":"Retrying a DROP TABLE after a timeout or schema-agreement delay; concurrent clients issuing the same drop; scripts that drop a transactional table and don't wait for the schema change to converge across nodes.","solutions":["Wait for the in-flight drop to complete (check schema agreement / system_schema) before reissuing the command","Use DROP TABLE IF EXISTS so an already-dropped (or dropping) table is not an error","Inspect table.params.pendingDrop via schema tables to confirm the drop is already pending","If the drop is stuck, resolve the pending schema change (check node schema versions) instead of issuing another drop"],"exampleFix":"// before\nDROP TABLE ks.tbl;\n// after (idempotent)\nDROP TABLE IF EXISTS ks.tbl;","handlingStrategy":"validation","validationCode":"var rows = session.execute(\"SELECT params FROM system_schema.tables WHERE keyspace_name=? AND table_name=?\", ks, table);\nif (rows.isEmpty()) return; // already gone\n// if pendingDrop is exposed/true, skip issuing DROP again","typeGuard":null,"tryCatchPattern":"try { session.execute(\"DROP TABLE IF EXISTS \" + ks + \".\" + table); }\ncatch (InvalidRequest e) { if (e.getMessage().contains(\"already being dropped\")) log.info(\"Drop already in progress\"); else throw e; }","preventionTips":["Always use IF EXISTS for DDL cleanup scripts","Wait for schema agreement after DDL before retrying","Avoid concurrent clients issuing the same DROP","Check pendingDrop/schema state on Accord-enabled tables before dropping"],"tags":["cassandra","cql","ddl","schema"],"backgroundTag":"invalid-state-transition","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}