{"record":{"id":"2c30431f3a6c7252","repo":"apache/cassandra","slug":"can-t-force-remove-completion-abort-the-remove-op","errorCode":null,"errorMessage":"Can't force remove completion, abort the remove operation and retry.","messagePattern":"Can't force remove completion, abort the remove operation and retry\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":3704,"sourceCode":"                {\n                    sb.append(\"Removing node \").append(nodeId.toUUID()).append(\" (\").append(metadata.directory.endpoint(nodeId)).append(')').append(\": \").append(seq.status());\n                    found = true;\n                }\n            }\n        }\n        if (!found)\n            sb.append(\"No removals in progress.\");\n        return sb.toString();\n    }\n\n    /**\n     * Force a remove operation to complete. This may be necessary if a remove operation\n     * blocks forever due to node/stream failure. removeNode() must be called\n     * first, this is a last resort measure.  No further attempt will be made to restore replicas.\n     */\n    public void forceRemoveCompletion()\n    {\n        throw new IllegalStateException(\"Can't force remove completion, abort the remove operation and retry.\");\n    }\n\n    /**\n     * Remove a node that has died, attempting to restore the replica count.\n     * If the node is alive, decommission should be attempted.  If decommission\n     * fails, then removeNode should be called.  If we fail while trying to\n     * restore the replica count, finally forceRemoveCompleteion should be\n     * called to forcibly remove the node without regard to replica count.\n     *\n     * @param hostIdString Host ID for the node\n     */\n    public void removeNode(String hostIdString)\n    {\n        removeNode(hostIdString, false);\n    }\n\n    public void removeNode(String hostIdString, boolean force)\n    {","sourceCodeStart":3686,"sourceCodeEnd":3722,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L3686-L3722","documentation":"forceRemoveCompletion is a last-resort hook that only works while a removal operation is in progress; in this code path it unconditionally throws IllegalStateException because no removal operation is active, telling the operator to abort and retry the remove instead.","triggerScenarios":"Calling `nodetool removenode force` (StorageServiceMBean.forceRemoveCompletion) when removeNode was never called on this node, the previous removal already completed, or the removal state was cleared after restart.","commonSituations":"Operators habitually appending 'force' to removenode; attempting to force-complete after the node was restarted (removal state lost); forcing removal on the wrong node (the one being removed rather than the coordinator).","solutions":["Run `nodetool removenode <hostId>` first (without force) on the removal coordinator","If a previous remove already finished, no force is needed — verify with nodetool netstats/ gossip","If removeNode fails, abort and re-run the removal rather than forcing"],"exampleFix":"// before\nnodetool removenode force\n// after\nnodetool removenode <host_id>   # standard removal; force only if removal is genuinely stuck in progress","handlingStrategy":"validation","validationCode":"// only call forceRemoveCompletion if a removal is actually in progress\nif (!removalInProgress())\n    throw new IllegalStateException(\"No remove operation in progress\");","typeGuard":null,"tryCatchPattern":"try { ss.forceRemoveCompletion(); } catch (IllegalStateException e) { /* no active removal: run normal removenode */ }","preventionTips":["Only use removenode force when a removal is verifiably stuck (netstats streaming stalled)","Re-check state after node restarts — removal state does not survive","Prefer aborting and re-running removal over forcing completion"],"tags":["cassandra","removenode","cluster-operation","invalid-state"],"backgroundTag":"invalid-state-transition","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"}