{"record":{"id":"79c3cb9603efe2cc","repo":"apache/cassandra","slug":"no-in-progress-sequence-of-kind-for-only-in-pr","errorCode":null,"errorMessage":"No in progress sequence of kind  for  (only  in progress)","messagePattern":"No in progress sequence of kind  for  \\(only  in progress\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tcm/sequences/InProgressSequences.java","lineNumber":94,"sourceCode":"                return metadata;\n            if (isLeave(sequence))\n                StorageService.instance.maybeInitializeServices();\n            if (resume(sequence))\n                metadata = ClusterMetadata.current();\n            else\n                return metadata;\n        }\n    }\n\n    public static boolean cancelInProgressSequences(String sequenceOwner, String expectedSequenceKind)\n    {\n        NodeId owner = NodeId.fromString(sequenceOwner);\n        MultiStepOperation<?> seq = ClusterMetadata.current().inProgressSequences.get(owner);\n        if (seq == null)\n            throw new IllegalArgumentException(\"No in progress sequence for \"+sequenceOwner);\n        MultiStepOperation.Kind expectedKind = MultiStepOperation.Kind.valueOf(expectedSequenceKind);\n        if (seq.kind() != expectedKind)\n            throw new IllegalArgumentException(\"No in progress sequence of kind \" + expectedKind + \" for \" + owner + \" (only \" + seq.kind() +\" in progress)\");\n\n        return StorageService.cancelInProgressSequences(owner);\n    }\n\n    @Override\n    public InProgressSequences withLastModified(Epoch epoch)\n    {\n        return new InProgressSequences(epoch, state);\n    }\n\n    @Override\n    public Epoch lastModified()\n    {\n        return lastModified;\n    }\n\n    public boolean contains(MultiStepOperation.SequenceKey key)\n    {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/sequences/InProgressSequences.java#L76-L112","documentation":"After finding an in-progress sequence for the node, cancelInProgressSequences checks that its kind matches the requested kind (e.g. BOOTSTRAP vs REPLACE). A mismatch throws IllegalArgumentException naming the expected kind, the owner, and the kind actually in progress. It prevents cancelling a different operation than the operator intended.","triggerScenarios":"Calling cancelInProgressSequences(owner, \"BOOTSTRAP\") while the node's in-progress sequence is of kind REPLACE (or vice versa); passing a kind string that is valid but not the one actually running.","commonSituations":"Copy-pasted nodetool/admin command with the wrong sequence kind; operator assumed a replace but the node is doing a bootstrap; automation using a stale kind after the operation was restarted as a different sequence.","solutions":["Read the actual in-progress kind from the error message and re-issue the cancel with that kind","Confirm what operation the node is performing (bootstrap vs replace vs other MultiStepOperation) before cancelling","Fix the automation/config that hard-codes the wrong kind","If both operations seem in flight, inspect TCM metadata; only one sequence per node should exist"],"exampleFix":"// before\nseq.cancelInProgressSequences(owner, \"BOOTSTRAP\");\n// after\nMultiStepOperation<?> op = ClusterMetadata.current().inProgressSequences.get(NodeId.fromString(owner));\nseq.cancelInProgressSequences(owner, op == null ? \"BOOTSTRAP\" : op.kind().name());","handlingStrategy":"type-guard","validationCode":"MultiStepOperation<?> op = ClusterMetadata.current().inProgressSequences.get(NodeId.fromString(owner));\nif (op != null && !op.kind().name().equals(expectedKind))\n    expectedKind = op.kind().name(); // align with actual","typeGuard":"boolean kindMatches(String owner, String kind) {\n    MultiStepOperation<?> op = ClusterMetadata.current().inProgressSequences.get(NodeId.fromString(owner));\n    return op != null && op.kind() == MultiStepOperation.Kind.valueOf(kind);\n}","tryCatchPattern":"try { cancelInProgressSequences(owner, kind); } catch (IllegalArgumentException e) { logger.warn(\"Kind mismatch: {}\", e.getMessage()); }","preventionTips":["Derive the kind from the live sequence, don't hard-code it","Validate kind strings against MultiStepOperation.Kind before calling","Log the actual kind when automation cancels sequences"],"tags":["illegal-argument","kind-mismatch","sequence","cluster-metadata"],"backgroundTag":"invalid-enum-value","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"}