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
- Check node disk space and `nodetool compactionstats` before retrying.
- Ensure no concurrent repair or major operations on the tables.
- Retry the compaction on each node individually to isolate the failing node.
- 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
- Keep free disk headroom (Cassandra recommends leaving room for compaction spikes).
- Avoid overlapping major compactions with repairs.
- Run compaction during low-write windows.
- Check the 'Caused by' for node-specific reasons before retrying.
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
- Error occurred during compaction keys
- Error occurred during enabling auto-compaction
- Error occurred during status-auto-compaction
- Error occurred during user defined compaction
- Aborted garbage collection for at least one table in…
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)