{"record":{"id":"73281357d2458551","repo":"apache/cassandra","slug":"error-occurred-during-compaction-keys","errorCode":null,"errorMessage":"Error occurred during compaction keys","messagePattern":"Error occurred during compaction keys","errorType":"console","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/ForceCompact.java","lineNumber":67,"sourceCode":"    @Override\n    public void execute(NodeProbe probe)\n    {\n        args = concatArgs(keyspace, table, keys);\n        // Check if the input has valid size\n        checkArgument(args.size() >= 3, \"forcecompact requires keyspace, table and keys args\");\n\n        // We rely on lower-level APIs to check and throw exceptions if the input keyspace or table name are invalid\n        String keyspaceName = args.get(0);\n        String tableName = args.get(1);\n        String[] partitionKeysIgnoreGcGrace = parsePartitionKeys(args);\n\n        try\n        {\n            probe.forceCompactionKeysIgnoringGcGrace(keyspaceName, tableName, partitionKeysIgnoreGcGrace);\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(\"Error occurred during compaction keys\", e);\n        }\n    }\n}","sourceCodeStart":49,"sourceCodeEnd":70,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/ForceCompact.java#L49-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the 'Caused by' chain for the underlying JMX or compaction error","Verify keyspace/table and partition key format (e.g. use -pk with properly escaped keys)","Confirm the node is UP and not draining via `nodetool status`","Retry after fixing arguments; check system log for compaction failures"],"exampleFix":"// before\nnodetool compact --partition-keys ks tbl key1\n// after (verify table exists first)\ncqlsh -e \"DESCRIBE TABLE ks.tbl\" && nodetool compact --partition-keys ks tbl key1","handlingStrategy":"try-catch","validationCode":"cqlsh -e \"DESCRIBE TABLE ks.tbl\" >/dev/null || { echo 'table missing'; exit 1; }","typeGuard":null,"tryCatchPattern":"try { probe.forceCompactionKeysIgnoringGcGrace(ks, tbl, keys); } catch (RuntimeException e) { handle(e.getCause()); }","preventionTips":["Confirm partition key strings match the table's key type","Check node status before issuing compaction commands","Inspect the caused-by chain rather than the wrapper message"],"tags":["nodetool","jmx","compaction"],"backgroundTag":"api-error-response","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}