{"record":{"id":"158753e04933c2c8","repo":"apache/cassandra","slug":"replace-method-removed-use-cassandra-replace-addr","errorCode":null,"errorMessage":"Replace method removed; use cassandra.replace_address instead","messagePattern":"Replace method removed; use cassandra\\.replace_address instead","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":808,"sourceCode":"\n            Gossiper.instance.addLocalApplicationState(ApplicationState.SSTABLE_VERSIONS,\n                                                       valueFactory.sstableVersions(versions));\n        });\n\n        if (SystemKeyspace.wasDecommissioned())\n        {\n            if (CassandraRelevantProperties.OVERRIDE_DECOMMISSION.getBoolean())\n            {\n                logger.warn(\"This node was decommissioned, but overriding by operator request.\");\n            }\n            else\n            {\n                throw new ConfigurationException(\"This node was decommissioned and will not rejoin the ring unless cassandra.override_decommission=true has been set, or all existing data is removed and the node is bootstrapped again\");\n            }\n        }\n\n        if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode() != null)\n            throw new RuntimeException(\"Replace method removed; use cassandra.replace_address instead\");\n\n        if (isReplacing())\n        {\n            if (SystemKeyspace.bootstrapComplete())\n                throw new RuntimeException(\"Cannot replace with a node that is already bootstrapped\");\n\n            InetAddressAndPort replaceAddress = DatabaseDescriptor.getReplaceAddress();\n            Directory directory = ClusterMetadata.current().directory;\n            if (directory.peerId(replaceAddress) == null || directory.peerState(replaceAddress) != JOINED)\n                throw new RuntimeException(String.format(\"Cannot replace node %s which is not currently joined\", replaceAddress));\n\n            BootstrapAndReplace.checkUnsafeReplace(shouldBootstrap());\n        }\n\n        if (isReplacingSameAddress())\n        {\n            BootstrapAndReplace.gossipStateToHibernate(ClusterMetadata.current(), ClusterMetadata.currentNullable().myNodeId());\n            Gossiper.instance.start(SystemKeyspace.incrementAndGetGeneration(), false);","sourceCodeStart":790,"sourceCodeEnd":826,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L790-L826","documentation":"The old token-based and host-id-based replace mechanisms (cassandra.replace_tokens / replace_node properties) were removed. initServer fails fast with a RuntimeException if either legacy setting is populated, directing operators to cassandra.replace_address.","triggerScenarios":"Starting a node with DatabaseDescriptor.getReplaceTokens() non-empty or getReplaceNode() set — i.e. cassandra.replace_tokens / cassandra.replace_node (or their yaml equivalents) still configured.","commonSituations":"Upgrading an old cluster where replace procedures were scripted with legacy flags; copied cassandra-env.sh or jvm-server.options carrying stale -Dcassandra.replace_tokens/-Dcassandra.replace_node entries.","solutions":["Remove cassandra.replace_tokens and cassandra.replace_node from jvm options/cassandra-env.sh","Set -Dcassandra.replace_address=<dead node ip> instead","Audit startup scripts after version upgrades for removed replace flags"],"exampleFix":"// before\nJVM_OPTS=\"$JVM_OPTS -Dcassandra.replace_tokens=...\"\n// after\nJVM_OPTS=\"$JVM_OPTS -Dcassandra.replace_address=10.0.0.5\"","handlingStrategy":"validation","validationCode":"grep -R 'cassandra.replace_tokens\\|cassandra.replace_node' jvm-server.options cassandra-env.sh  # must be empty","typeGuard":null,"tryCatchPattern":"try { startNode(); } catch (RuntimeException e) { if (e.getMessage().contains(\"Replace method removed\")) { /* fix startup flags */ } }","preventionTips":["Audit startup scripts after major version upgrades","Use only cassandra.replace_address for replacements","Centralize JVM options to avoid stale flags in copies"],"tags":["replace","configuration","deprecated","startup"],"backgroundTag":"deprecated-api-usage","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"}