apache/cassandra · error · RuntimeException

Error occurred during compaction

Error message

Error occurred during compaction

What it means

After option validation, Compact submits keyspace/table compaction via probe.forceKeyspaceCompaction over JMX; any Exception is wrapped as 'Error occurred during compaction'. It signals the remote node failed to start or complete the compaction request.

Solutions

  1. Check node disk space and `nodetool compactionstats` before retrying.
  2. Ensure no concurrent repair or major operations on the tables.
  3. Retry the compaction on each node individually to isolate the failing node.
  4. Inspect the 'Caused by' of this RuntimeException for the remote error detail.

Example fix

// before
nodetool compact ks  # fails with 95% disk usage
// after
df -h; nodetool compactionstats  # free space / check conflicts, then retry
nodetool compact ks
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight checks
assertFreeDisk(node, requiredBytes);
assertNoActiveRepair(node);  // nodetool netstats / repair_admin
assertCompactionQueueNotSaturated(node); // nodetool compactionstats

Try / catch

try { probe.forceKeyspaceCompaction(splitOutput, parallelism, ks, tables); }
catch (RuntimeException e) {
    log.warn("Compaction failed: " + e.getCause());
    // free disk / resolve conflicts, then retry with backoff
}

Prevention

When it happens

Trigger: `nodetool compact <keyspace> [tables]` when the node has insufficient disk space, ongoing repairs/compactions conflict, the keyspace/table exists but compaction is disallowed, or JMX call fails mid-operation.

Common situations: Disk nearly full (compaction needs free space for merged SSTables); running during a repair; compacting a table with pending validation; nodetool targeting a degraded node.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/Compact.java:117

            {
                if (startEndTokenProvided)
                {
                    probe.forceKeyspaceCompactionForTokenRange(keyspace, startToken, endToken, tableNames);
                }
                else if (partitionKeyProvided)
                {
                    probe.forceKeyspaceCompactionForPartitionKey(keyspace, partitionKey, tableNames);
                }
                else
                {
                    if (parallelism != null)
                        probe.forceKeyspaceCompaction(splitOutput, parallelism, keyspace, tableNames);
                    else // avoid referring to the new method to work with older versions
                        probe.forceKeyspaceCompaction(splitOutput, keyspace, tableNames);
                }
            } catch (Exception e)
            {
                throw new RuntimeException("Error occurred during compaction", e);
            }
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)