{"record":{"id":"45a48aa4f6973334","repo":"apache/cassandra","slug":"s-is-not-currently-joining-the-cms","errorCode":null,"errorMessage":"%s is not currently joining the CMS","messagePattern":"(.+?) is not currently joining the CMS","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/tcm/CMSMembership.java","lineNumber":150,"sourceCode":"    public Set<NodeId> fullMembers()\n    {\n        return fullMembers;\n    }\n\n    public CMSMembership startJoining(NodeId id)\n    {\n        if (joiningMembers.contains(id))\n            throw new IllegalStateException(id + \" is already joining the CMS\");\n        if (fullMembers.contains(id))\n            throw new IllegalStateException(id + \" has already fully joined the CMS\");\n\n        return new CMSMembership(lastModified, fullMembers, joiningMembers.with(id));\n    }\n\n    public CMSMembership cancelJoining(NodeId id)\n    {\n        if (!joiningMembers.contains(id))\n            throw new IllegalStateException(id + \" is not currently joining the CMS\");\n        if (fullMembers.contains(id))\n            throw new IllegalStateException(id + \" has already fully joined the CMS\");\n\n        return new CMSMembership(lastModified, fullMembers, joiningMembers.without(id));\n    }\n\n    public CMSMembership finishJoining(NodeId id)\n    {\n        if (!joiningMembers.contains(id))\n            throw new IllegalStateException(id + \" is not currently joining the CMS\");\n        if (fullMembers.contains(id))\n            throw new IllegalStateException(id + \" has already fully joined the CMS\");\n\n        return new CMSMembership(lastModified, fullMembers.with(id), joiningMembers.without(id));\n    }\n\n    public CMSMembership leave(NodeId id)\n    {","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/CMSMembership.java#L132-L168","documentation":"CMSMembership.cancelJoining removes a node from the joiningMembers set. It throws IllegalStateException if the id is not currently in that set, because there is no in-flight join to cancel — the transformation would be a no-op or hide a state bug.","triggerScenarios":"Applying a cancelJoining transformation for a NodeId absent from joiningMembers — cancelling a join that already finished (or failed) via finishJoining, was never started, or whose state was already rolled forward/back in a later epoch.","commonSituations":"Timeout handling that cancels a join after it already completed; running cleanup for joins on wrong/stale epoch snapshots; double-cancellation from two failure handlers.","solutions":["Before cancelling, read the node's current CMS state from the latest epoch and only cancel if it is genuinely in joiningMembers","Handle the exception as an expected race in join timeout logic: re-read metadata and decide based on current state (finished joining? then nothing to do)","Serialize join lifecycle operations through a single owner so cancel cannot race finishJoining","If the join state is stuck inconsistent, fix it via explicit finishJoining or a fresh startJoining rather than cancelJoining"],"exampleFix":"// before\nmembership = cms.cancelJoining(nodeId); // throws if not joining\n// after\nif (cms.joiningMembers().contains(nodeId))\n    membership = cms.cancelJoining(nodeId);","handlingStrategy":"validation","validationCode":"if (!membership.joiningMembers().contains(nodeId)) return; // nothing to cancel","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the node is still in joiningMembers in the latest epoch before cancelling","Guard timeout handlers against cancelling completed joins","Centralize join lifecycle transitions in one owner"],"tags":["tcm","cms","join"],"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-14T16:17:12.679Z"}