{"record":{"id":"5bb770b99966b6ba","repo":"apache/cassandra","slug":"error-occurred-during-garbage-collection","errorCode":null,"errorMessage":"Error occurred during garbage collection","messagePattern":"Error occurred during garbage collection","errorType":"console","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/GarbageCollect.java","lineNumber":95,"sourceCode":"            }\n            catch (Exception e)\n            {\n                throw new RuntimeException(\"Error occurred during user defined garbage collection\", e);\n            }\n            return;\n        }\n\n        List<String> keyspaces = parseOptionalKeyspace(args, probe);\n        String[] tableNames = parseOptionalTables(args);\n\n        for (String keyspace : keyspaces)\n        {\n            try\n            {\n                probe.garbageCollect(probe.output().out, tombstoneOption.toString(), jobs, keyspace, tableNames);\n            } catch (Exception e)\n            {\n                throw new RuntimeException(\"Error occurred during garbage collection\", e);\n            }\n        }\n    }\n}\n","sourceCodeStart":77,"sourceCodeEnd":100,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/GarbageCollect.java#L77-L100","documentation":"GarbageCollect, for the explicit-keyspace path, wraps any exception from garbageCollect in a RuntimeException. It means the user-defined GC compaction for the specified keyspace/table failed server-side or the JMX invocation failed.","triggerScenarios":"Running `nodetool garbagecollect [keyspace [tables...]]` with a nonexistent keyspace/table, invalid tombstone option, or when StorageService rejects the compaction (e.g. node busy, streaming in progress).","commonSituations":"Post-delete cleanup runs scripted per keyspace; typos in keyspace names in cron scripts; conflicts with ongoing major compactions or repairs.","solutions":["Read the 'Caused by' exception for the underlying error","Verify keyspace/table names against cqlsh DESCRIBE output","Ensure no conflicting repair/compaction is running (nodetool compactionstats, netstats)","Retry with a valid tombstone option (row/cell) and modest -j value"],"exampleFix":"// before\nnodetool garbagecollect wrongks\n// after\ncqlsh -e \"DESCRIBE KEYSPACES\" | grep wrongks || nodetool garbagecollect correctks","handlingStrategy":"try-catch","validationCode":"cqlsh -e \"DESCRIBE KEYSPACES\" | grep -qw \"$KS\" || { echo 'unknown keyspace'; exit 1; }","typeGuard":null,"tryCatchPattern":"try { probe.garbageCollect(out, opt, jobs, ks, tables); } catch (RuntimeException e) { handle(e.getCause()); }","preventionTips":["Verify keyspace/table names before scripted runs","Check compactionstats for conflicting operations","Keep -j modest to avoid overloading the node"],"tags":["nodetool","jmx","garbage-collect"],"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"}