apache/cassandra · error · IllegalStateException

Current initiator [ ] does not match provided - run this…

Error message

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

What it means

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.

Solutions

  1. Read the current initiator from the node's logs or the error message and re-run abortInitialization with that exact value
  2. Run the abort command on the node where initialization is still pending (not yet cleared)
  3. If the migration already completed, no abort is needed - check migration state first
  4. Use nodetool cms show/show-state (or equivalent) to get the authoritative current initiator

Example fix

// before
nodetool cms abort initialization --initiator 550e8400-e29b...  // stale id
// after
nodetool cms abort initialization --initiator <current initiator from error/log>
Defensive patterns

Strategy: validation

Validate before calling

Object currentInitiator = Election.initiator(); if (!Objects.equals(currentInitiator, expectedInitiator)) throw new IllegalStateException("Refusing to abort: current=" + currentInitiator);

Try / catch

try { election.abortInitialization(expectedInitiator, ...); } catch (IllegalStateException e) { // re-read the current initiator from the message and retry with it }

Prevention

When it happens

Trigger: Calling abortInitialization (e.g. nodetool cms abort initialization) with an initiator UUID/address that does not match the one recorded in Election.initiator.

Common situations: 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.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/e4d061a909884ba3. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/tcm/migration/Election.java:214

    }

    public void abortInitialization(String initiatorEp)
    {
        InetAddressAndPort expectedInitiator = InetAddressAndPort.getByNameUnchecked(initiatorEp);
        CMSInitializationRequest.Initiator currentInitiator = initiator.get();
        if (currentInitiator != null && Objects.equals(currentInitiator.endpoint, expectedInitiator) && initiator.compareAndSet(currentInitiator, null))
        {
            ClusterMetadata metadata = ClusterMetadata.current();
            for (Map.Entry<NodeId, NodeState> entry : metadata.directory.states.entrySet())
            {
                NodeId nodeId = entry.getKey();
                if (!Objects.equals(metadata.myNodeId(), nodeId) && entry.getValue() != LEFT)
                    messaging.send(Message.out(Verb.TCM_ABORT_MIG, currentInitiator), metadata.directory.endpoint(nodeId));
            }
        }
        else
        {
            throw new IllegalStateException("Current initiator [" + currentInitiator +"] does not match provided " + expectedInitiator +
                                            " - run this command on a node where initialization has not yet been cleared, with the correct expected initiator");
        }
    }

    public class PrepareHandler implements IVerbHandler<CMSInitializationRequest>
    {
        @Override
        public void doVerb(Message<CMSInitializationRequest> message) throws IOException
        {
            logger.info("Received election initiation message {} from {}", message.payload, message.from());
            if (!updateInitiator(null, message.payload.initiator))
                throw new IllegalStateException(String.format("Got duplicate initiate migration message from %s, migration is already started by %s", message.from(), initiator()));

            logger.info("Sending initiation response");
            Directory initiatorDirectory = message.payload.directory;
            TokenMap initiatorTokenMap = message.payload.tokenMap;
            UUID initiatorSchemaVersion = message.payload.schemaVersion;
            ClusterMetadata metadata = ClusterMetadata.current();

View on GitHub (pinned to 88fd0f6a0e)