apache/cassandra · error · InvalidRequestException
Cannot drop keyspace
Error message
Cannot drop keyspace '%s' as it contains accord tables which are currently being dropped. Please wait for those operations to complete before dropping the keyspace. (%s)
What it means
DROP KEYSPACE was rejected because the keyspace contains Accord-enabled tables currently in the process of being dropped (params.pendingDrop). Dropping the keyspace now would race with those in-flight table drops, so Cassandra refuses until they complete.
Solutions
- Wait for the pending table drops to complete (tables are listed in the error), then retry DROP KEYSPACE.
- Poll system_schema.tables or driver schema metadata until the listed tables disappear.
- Retry DROP KEYSPACE with a backoff loop.
Example fix
// before DROP KEYSPACE ks; // issued right after DROP TABLE ks.txn // after -- wait until pending tables vanish, then: DROP KEYSPACE ks;
Defensive patterns
Strategy: retry
Validate before calling
boolean pending = schema.getKeyspace(ks).tables.stream()
.anyMatch(t -> t.params.pendingDrop);
if (pending) scheduleRetryAfterSchemaAgreement(); Try / catch
catch (InvalidRequestException e) { if (e.getMessage().contains("currently being dropped")) { retryWithBackoff(); } else throw e; } Prevention
- Wait for schema agreement after dropping Accord tables before dropping the keyspace
- Serialize keyspace teardown after table teardown
- Monitor pendingDrop state in maintenance tooling
When it happens
Trigger: DROP KEYSPACE ks while any table in ks has params.pendingDrop == true, i.e. a DROP TABLE on an Accord transactional table was initiated but not finished.
Common situations: Re-issuing DROP KEYSPACE immediately after DROP TABLE on an Accord-backed table while the async drop propagates through the cluster; test teardown dropping keyspaces too quickly.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Cannot create table . with transactional mode with…
- Cannot drop keyspace
- Cannot set transactional migration on new tables
- ACCESS TO DATACENTERS operations not supported by…
- Accord transactions are disabled on table (See…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/6f799f5f1763dfae.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/statements/schema/DropKeyspaceStatement.java:68
{
return metadata.directory.commonSerializationVersion.isAtLeast(Version.V0);
}
@Override
public Keyspaces apply(ClusterMetadata metadata)
{
Guardrails.dropKeyspaceEnabled.ensureEnabled(state);
Keyspaces schema = metadata.schema.getKeyspaces();
KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
if (keyspace != null)
{
// check that no accord tables in the keyspace are currently in the process of being dropped
List<TableMetadata> pendingDrop = keyspace.tables.stream()
.filter(t -> t.params.pendingDrop)
.collect(Collectors.toList());
if (!pendingDrop.isEmpty())
throw ire("Cannot drop keyspace '%s' as it contains accord tables which are currently being dropped. " +
"Please wait for those operations to complete before dropping the keyspace. (%s)",
keyspaceName, pendingDrop.stream()
.map(Object::toString)
.collect(Collectors.joining(",")));
List<TableMetadata> accordTables = keyspace.tables.stream()
.filter(TableMetadata::requiresAccordSupport)
.collect(Collectors.toList());
if (!accordTables.isEmpty())
throw ire("Cannot drop keyspace '%s' as it contains accord tables. (%s)",
keyspaceName, accordTables.stream()
.map(Object::toString)
.collect(Collectors.joining(",")));
return schema.without(keyspaceName);
}
if (ifExists)
return schema;View on GitHub (pinned to 88fd0f6a0e)