apache/cassandra · error · InvalidRequestException

Cannot drop keyspace

Error message

Cannot drop keyspace '%s' as it contains accord tables. (%s)

What it means

DROP KEYSPACE was rejected because the keyspace still contains Accord-enabled (transactional) tables. This build does not allow dropping a keyspace while Accord tables exist; they must be dropped individually first.

Solutions

  1. Drop each Accord table explicitly (DROP TABLE ...), waiting for drops to complete.
  2. Then re-run DROP KEYSPACE.
  3. Relocate Accord tables to a dedicated keyspace so other keyspaces can be dropped freely.

Example fix

// before
DROP KEYSPACE ks; // contains txn tables
// after
DROP TABLE ks.txn_orders;
DROP KEYSPACE ks;
Defensive patterns

Strategy: validation

Validate before calling

boolean hasAccord = schema.getKeyspace(ks).tables.stream()
    .anyMatch(TableMetadata::requiresAccordSupport);
if (hasAccord) dropAccordTablesFirst(ks);

Try / catch

catch (InvalidRequestException e) { if (e.getMessage().contains("accord tables")) { /* parse table list from message and drop them first */ } else throw e; }

Prevention

When it happens

Trigger: DROP KEYSPACE ks where any table in ks returns requiresAccordSupport() == true and none are merely pendingDrop.

Common situations: Tearing down a keyspace holding transactional (Accord) tables; cleanup scripts written before Accord support that assume DROP KEYSPACE covers all tables.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/8a69efde9a22d6f9. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/statements/schema/DropKeyspaceStatement.java:78

        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;

        throw ire("Keyspace '%s' doesn't exist", keyspaceName);
    }

    SchemaChange schemaChangeEvent(KeyspacesDiff diff)
    {
        return new SchemaChange(Change.DROPPED, keyspaceName);
    }

    public void authorize(ClientState client)

View on GitHub (pinned to 88fd0f6a0e)