{"record":{"id":"a71cc486321e6337","repo":"apache/cassandra","slug":"is-not-currently-joining-the-cms","errorCode":null,"errorMessage":" is not currently joining the CMS","messagePattern":" is not currently joining the CMS","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tcm/CMSMembership.java","lineNumber":160,"sourceCode":"            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    {\n        if (joiningMembers.contains(id))\n            throw new IllegalStateException(id + \" is currently joining the CMS, \");\n        if (!fullMembers.contains(id))\n            throw new IllegalStateException(id + \" is not a CMS member\");\n\n        return new CMSMembership(lastModified, fullMembers.without(id), joiningMembers);\n    }\n\n    @Override\n    public String toString()","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/CMSMembership.java#L142-L178","documentation":"Thrown by CMSMembership.finishJoining when a node is asked to complete its CMS membership but it is not present in the joiningMembers set. TCM tracks CMS membership in two phases: joining and full members. The state machine requires a node to be in the joining set before finishJoining can promote it.","triggerScenarios":"Calling finishJoining(NodeId) for a node id that was never added as a joining member, or after it was already promoted to a full member or removed.","commonSituations":"Replaying a JoinCluster/FinishJoin transformation twice, a retry racing with an already-committed transformation, or operator tooling invoking finishJoining out of order during cluster bootstrap.","solutions":["Check the node's current membership state before calling finishJoining (verify it appears in joiningMembers).","Do not retry finishJoining after a successful commit; treat a prior committed transformation as terminal.","If the node already fully joined, no action is needed - remove the duplicate call."],"exampleFix":"// before\nmetadata.forId(id).finishJoining(id);\n// after\nif (metadata.fullMembers.contains(id)) { /* already joined, skip */ }\nelse if (metadata.joiningMembers.contains(id)) { metadata.finishJoining(id); }","handlingStrategy":"validation","validationCode":"if (!ClusterMetadata.current().joiningMembers.contains(nodeId)) throw new IllegalStateException(nodeId + \" not in joining state; skip finishJoining\");","typeGuard":null,"tryCatchPattern":"try { membership.finishJoining(id); } catch (IllegalStateException e) { logger.warn(\"finishJoining skipped: {}\", e.getMessage()); }","preventionTips":["Check joiningMembers before promoting a node","Never replay committed transformations","Make join flows idempotent by state inspection"],"tags":["tcm","cms-membership","invalid-state-transition"],"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"}