apache/cassandra · error · IllegalStateException

Can not apply in-progress sequence, since its kind is

Error message

Can not apply in-progress sequence, since its kind is %s, but not %s

What it means

Thrown by ReconfigureCMS.applyTo when the in-progress sequence stored under the ReconfigureCMS SequenceKey has a kind other than MultiStepOperation.Kind.RECONFIGURE_CMS. applyTo expects to drive an in-progress CMS reconfiguration to completion; a different sequence kind under that key means the metadata state does not match what the transformation assumes.

Solutions

  1. Let the conflicting in-progress sequence finish before initiating the CMS reconfiguration
  2. Inspect ClusterMetadata.current().inProgressSequences to identify the wrongly keyed sequence
  3. Ensure only one topology operation runs at a time (serialize operator actions)
  4. If caused by a metadata log anomaly, restore consistency per the project's TCM recovery guidance and file a bug
Defensive patterns

Strategy: validation

Validate before calling

MultiStepOperation<?> seq = ClusterMetadata.current().inProgressSequences.get(SequenceKey.instance);
if (seq != null && seq.kind() != MultiStepOperation.Kind.RECONFIGURE_CMS)
    throw new PreconditionFailed("SequenceKey occupied by " + seq.kind());

Try / catch

try { clusterMetadataService.commit(new ReconfigureCMS(...)); }
catch (IllegalStateException e) { if (e.getMessage().contains("Can not apply in-progress sequence")) waitForOtherSequenceThenRetry(); else throw e; }

Prevention

When it happens

Trigger: Committing/apply-ing a ReconfigureCMS transformation while metadata.inProgressSequences.get(SequenceKey.instance) holds some other MultiStepOperation (e.g. a Move or Bootstrap sequence) under the same key.

Common situations: Overlapping topology operations: starting a CMS reconfiguration while another multi-step operation occupies the SequenceKey; replay/recovery of a metadata log where sequences were interleaved; concurrent nodetool operations racing.

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/aa57c4ff2943adfa. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/tcm/sequences/ReconfigureCMS.java:164

    }

    @Override public Transformation.Kind nextStep()
    {
        return next.kind();
    }

    @Override
    public Set<NodeId> affectedPeers(Directory directory)
    {
        return Set.of();
    }

    @Override
    public Transformation.Result applyTo(ClusterMetadata metadata)
    {
        MultiStepOperation<?> sequence = metadata.inProgressSequences.get(SequenceKey.instance);
        if (sequence.kind() != MultiStepOperation.Kind.RECONFIGURE_CMS)
            throw new IllegalStateException(String.format("Can not apply in-progress sequence, since its kind is %s, but not %s", sequence.kind(), MultiStepOperation.Kind.RECONFIGURE_CMS));
        Epoch lastModifiedEpoch = metadata.epoch;
        ImmutableSet.Builder<MetadataKey> modifiedKeys = ImmutableSet.builder();
        while (metadata.inProgressSequences.contains(SequenceKey.instance))
        {
            ReconfigureCMS transitionCMS = (ReconfigureCMS) metadata.inProgressSequences.get(SequenceKey.instance);
            Transformation.Result result = transitionCMS.next.execute(metadata);
            assert result.isSuccess();
            metadata = result.success().metadata.forceEpoch(lastModifiedEpoch);
            modifiedKeys.addAll(result.success().affectedMetadata);
        }
        return new Transformation.Success(metadata.forceEpoch(lastModifiedEpoch.nextEpoch()), LockedRanges.AffectedRanges.EMPTY, modifiedKeys.build());
    }

    @Override
    public SequenceState executeNext()
    {
        ClusterMetadata metadata = ClusterMetadata.current();
        MultiStepOperation<?> sequence = metadata.inProgressSequences.get(SequenceKey.instance);

View on GitHub (pinned to 88fd0f6a0e)