apache/cassandra · error · RuntimeException

Error occurred during compaction keys

Error message

Error occurred during compaction keys

What it means

ForceCompact wraps any exception from forceCompactionKeysIgnoringGcGrace in a RuntimeException. It means nodetool failed to issue or execute the compaction of the given partition keys with GC grace ignored, either due to a JMX/transport failure or a server-side compaction error.

Solutions

  1. Inspect the 'Caused by' chain for the underlying JMX or compaction error
  2. Verify keyspace/table and partition key format (e.g. use -pk with properly escaped keys)
  3. Confirm the node is UP and not draining via `nodetool status`
  4. Retry after fixing arguments; check system log for compaction failures

Example fix

// before
nodetool compact --partition-keys ks tbl key1
// after (verify table exists first)
cqlsh -e "DESCRIBE TABLE ks.tbl" && nodetool compact --partition-keys ks tbl key1
Defensive patterns

Strategy: try-catch

Validate before calling

cqlsh -e "DESCRIBE TABLE ks.tbl" >/dev/null || { echo 'table missing'; exit 1; }

Try / catch

try { probe.forceCompactionKeysIgnoringGcGrace(ks, tbl, keys); } catch (RuntimeException e) { handle(e.getCause()); }

Prevention

When it happens

Trigger: Running `nodetool compact --partition-keys <ks> <table> <key>...` with a nonexistent keyspace/table, malformed partition key string, or when the storage service rejects the compaction request.

Common situations: Tombstone cleanup operators forcing compaction of specific partitions after a bad delete; typo in table name; running against a node that is draining or offline.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/ForceCompact.java:67

    @Override
    public void execute(NodeProbe probe)
    {
        args = concatArgs(keyspace, table, keys);
        // Check if the input has valid size
        checkArgument(args.size() >= 3, "forcecompact requires keyspace, table and keys args");

        // We rely on lower-level APIs to check and throw exceptions if the input keyspace or table name are invalid
        String keyspaceName = args.get(0);
        String tableName = args.get(1);
        String[] partitionKeysIgnoreGcGrace = parsePartitionKeys(args);

        try
        {
            probe.forceCompactionKeysIgnoringGcGrace(keyspaceName, tableName, partitionKeysIgnoreGcGrace);
        }
        catch (Exception e)
        {
            throw new RuntimeException("Error occurred during compaction keys", e);
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)