{"record":{"id":"383219b8a314fe9e","repo":"apache/cassandra","slug":"can-t-abort-bootstrap-for-since-it-is-not-bootstr","errorCode":null,"errorMessage":"Can't abort bootstrap for  since it is not bootstrapping","messagePattern":"Can't abort bootstrap for  since it is not bootstrapping","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":1684,"sourceCode":"        logger.info(\"Aborting bootstrap for {}\", StringUtils.isEmpty(nodeStr) ? endpointStr : nodeStr);\n        ClusterMetadata metadata = ClusterMetadata.current();\n        NodeId nodeId = parseNodeIdOrEndpoint(metadata, nodeStr, endpointStr);\n        InetAddressAndPort endpoint = metadata.directory.endpoint(nodeId);\n        if (endpoint == null)\n            throw new IllegalArgumentException(\"Can't abort bootstrap for \" + nodeId + \" - it does not exist in cluster metadata\");\n        if (Gossiper.instance.isKnownEndpoint(endpoint) && FailureDetector.instance.isAlive(endpoint))\n            throw new RuntimeException(\"Can't abort bootstrap for \" + nodeId + \" - it is alive\");\n        NodeState nodeState = metadata.directory.peerState(nodeId);\n        switch (nodeState)\n        {\n            case REGISTERED:\n            case BOOTSTRAPPING:\n            case BOOT_REPLACING:\n                if (metadata.inProgressSequences.contains(nodeId))\n                {\n                    MultiStepOperation<?> seq = metadata.inProgressSequences.get(nodeId);\n                    if (seq.kind() != MultiStepOperation.Kind.JOIN && seq.kind() != MultiStepOperation.Kind.REPLACE)\n                        throw new RuntimeException(\"Can't abort bootstrap for \" + nodeId + \" since it is not bootstrapping\");\n                    ClusterMetadataService.instance().commit(new CancelInProgressSequence(nodeId));\n                }\n                ClusterMetadataService.instance().commit(new Unregister(nodeId, EnumSet.of(REGISTERED, BOOTSTRAPPING, BOOT_REPLACING), ClusterMetadataService.instance().placementProvider()));\n                break;\n            default:\n                throw new RuntimeException(\"Can't abort bootstrap for node \" + nodeId + \" since the state is \" + nodeState);\n        }\n    }\n\n    private static NodeId parseNodeIdOrEndpoint(ClusterMetadata metadata, String nodeStr, String endpointStr)\n    {\n        NodeId nodeId;\n        if (!StringUtils.isEmpty(nodeStr))\n        {\n            try\n            {\n                nodeId = NodeId.fromString(nodeStr);\n            }","sourceCodeStart":1666,"sourceCodeEnd":1702,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L1666-L1702","documentation":"Thrown by StorageService.abortBootstrap when the node's directory state is REGISTERED/BOOTSTRAPPING/BOOT_REPLACING and an in-progress sequence exists for it, but that sequence's kind is neither JOIN nor REPLACE - i.e. the tracked operation is not actually a bootstrap, so cancelling it as one is refused.","triggerScenarios":"Aborting a node whose inProgressSequences entry is a different multi-step operation kind (e.g. a REBUILD or other MultiStepOperation) while its peer state still reads BOOTSTRAPPING.","commonSituations":"Node previously completed a bootstrap and is now running a different streaming operation; operator confuses rebuild/repair operations with bootstrap; state left from a partially-cancelled sequence.","solutions":["Inspect the in-progress sequence kind (ClusterMetadata inProgressSequences) and use the correct abort/cancel command for that operation kind","If the sequence is stale/corrupted, restart the node so the sequence is rebuilt or completes, then retry","Use the operation-specific cancel path (e.g. cancel the rebuild) instead of abortbootstrap","File/consult CASSANDRA issues if the state seems inconsistent - this may indicate metadata inconsistency requiring operator cleanup"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the in-progress sequence is a JOIN/REPLACE before aborting\n// Inspect ClusterMetadata inProgressSequences for the node; only call abortbootstrap\n// when kind is JOIN or REPLACE, otherwise use the operation-specific cancel.","typeGuard":null,"tryCatchPattern":"try {\n    probe.abortBootstrap(nodeId);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"since it is not bootstrapping\"))\n        log.warn(\"In-progress sequence is not JOIN/REPLACE; use the matching cancel operation\");\n    else throw e;\n}","preventionTips":["Distinguish bootstrap from rebuild/other streaming operations before choosing an abort command","Inspect in-progress sequence kind via cluster metadata tooling","Avoid leaving partially-cancelled sequences; let operations complete or cancel them properly"],"tags":["nodetool","bootstrap","cluster-metadata","multistep-operation"],"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-14T16:17:12.679Z"}