{"record":{"id":"e4d061a909884ba3","repo":"apache/cassandra","slug":"current-initiator-s-does-not-match-provided-s","errorCode":null,"errorMessage":"Current initiator [%s] does not match provided %s - run this command on a node where initialization has not yet been cleared, with the correct expected initiator","messagePattern":"Current initiator \\[(.+?)\\] does not match provided (.+?) - run this command on a node where initialization has not yet been cleared, with the correct expected initiator","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tcm/migration/Election.java","lineNumber":214,"sourceCode":"    }\n\n    public void abortInitialization(String initiatorEp)\n    {\n        InetAddressAndPort expectedInitiator = InetAddressAndPort.getByNameUnchecked(initiatorEp);\n        CMSInitializationRequest.Initiator currentInitiator = initiator.get();\n        if (currentInitiator != null && Objects.equals(currentInitiator.endpoint, expectedInitiator) && initiator.compareAndSet(currentInitiator, null))\n        {\n            ClusterMetadata metadata = ClusterMetadata.current();\n            for (Map.Entry<NodeId, NodeState> entry : metadata.directory.states.entrySet())\n            {\n                NodeId nodeId = entry.getKey();\n                if (!Objects.equals(metadata.myNodeId(), nodeId) && entry.getValue() != LEFT)\n                    messaging.send(Message.out(Verb.TCM_ABORT_MIG, currentInitiator), metadata.directory.endpoint(nodeId));\n            }\n        }\n        else\n        {\n            throw new IllegalStateException(\"Current initiator [\" + currentInitiator +\"] does not match provided \" + expectedInitiator +\n                                            \" - run this command on a node where initialization has not yet been cleared, with the correct expected initiator\");\n        }\n    }\n\n    public class PrepareHandler implements IVerbHandler<CMSInitializationRequest>\n    {\n        @Override\n        public void doVerb(Message<CMSInitializationRequest> message) throws IOException\n        {\n            logger.info(\"Received election initiation message {} from {}\", message.payload, message.from());\n            if (!updateInitiator(null, message.payload.initiator))\n                throw new IllegalStateException(String.format(\"Got duplicate initiate migration message from %s, migration is already started by %s\", message.from(), initiator()));\n\n            logger.info(\"Sending initiation response\");\n            Directory initiatorDirectory = message.payload.directory;\n            TokenMap initiatorTokenMap = message.payload.tokenMap;\n            UUID initiatorSchemaVersion = message.payload.schemaVersion;\n            ClusterMetadata metadata = ClusterMetadata.current();","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/migration/Election.java#L196-L232","documentation":"Election.abortInitialization clears an in-progress migration initiator. It compares the recorded currentInitiator with the caller-provided expectedInitiator and throws IllegalStateException when they differ, forcing the operator to explicitly confirm which initiator they intend to abort.","triggerScenarios":"Calling abortInitialization (e.g. nodetool cms abort initialization) with an initiator UUID/address that does not match the one recorded in Election.initiator.","commonSituations":"Stale command output: operator aborts using the initiator from an old log line while a newer migration started; typo'd or copied-wrong UUID; attempting to abort on a node where initialization was already cleared.","solutions":["Read the current initiator from the node's logs or the error message and re-run abortInitialization with that exact value","Run the abort command on the node where initialization is still pending (not yet cleared)","If the migration already completed, no abort is needed - check migration state first","Use nodetool cms show/show-state (or equivalent) to get the authoritative current initiator"],"exampleFix":"// before\nnodetool cms abort initialization --initiator 550e8400-e29b...  // stale id\n// after\nnodetool cms abort initialization --initiator <current initiator from error/log>","handlingStrategy":"validation","validationCode":"Object currentInitiator = Election.initiator(); if (!Objects.equals(currentInitiator, expectedInitiator)) throw new IllegalStateException(\"Refusing to abort: current=\" + currentInitiator);","typeGuard":null,"tryCatchPattern":"try { election.abortInitialization(expectedInitiator, ...); } catch (IllegalStateException e) { // re-read the current initiator from the message and retry with it }","preventionTips":["Fetch the initiator fresh from logs/state, never reuse old command output","Verify migration is still in progress before aborting","Run abort on the same node where the initiator was recorded"],"tags":["cassandra","tcm","state-machine"],"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"}