{"record":{"id":"eef391f16e9a99af","repo":"apache/cassandra","slug":"nodeid-does-not-match-locally-set-one-check-for-t","errorCode":null,"errorMessage":"NodeId does not match locally set one. Check for the IP address collision: %s vs %s %s.","messagePattern":"NodeId does not match locally set one\\. Check for the IP address collision: (.+?) vs (.+?) (.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/tcm/Startup.java","lineNumber":245,"sourceCode":"                                                                      wrapProcessor,\n                                                                      ClusterMetadataService::state,\n                                                                      logSpec));\n        ClusterMetadataService.instance().log().ready();\n        NodeId nodeId = ClusterMetadata.current().myNodeId();\n        UUID currentHostId = SystemKeyspace.getLocalHostId();\n        if (nodeId != NodeId.UNREGISTERED && !Objects.equals(nodeId.toUUID(), currentHostId))\n        {\n            if (currentHostId == null)\n            {\n                logger.info(\"Taking over the host ID: {}, replacing address {}\", nodeId.toUUID(), FBUtilities.getBroadcastAddressAndPort());\n                SystemKeyspace.setLocalHostId(nodeId.toUUID());\n                return;\n            }\n\n            String error = String.format(\"NodeId does not match locally set one. Check for the IP address collision: %s vs %s %s.\",\n                                         currentHostId, nodeId.toUUID(), FBUtilities.getBroadcastAddressAndPort());\n            logger.error(error);\n            throw new IllegalStateException(error);\n        }\n    }\n\n\n    /**\n     * If the broadcast address of this node has changed, we must verify the endpoints it knows for\n     * the members of the CMS are still reachable and valid. This is necessary for the node to submit\n     * a STARTUP transformation which updates its broadcast address in ClusterMetadata.\n     *\n     * If the node is itself a CMS member, it is also a requirement to be able to contact a\n     * majority of the other CMS members in order to perform the serial reads and writes which\n     * constitute committing to and fetching from the distributed metadata log.\n     *\n     * To do this, we use a simple protocol:\n     * 1. For each CMS member in our replayed ClusterMetadata, ping the associated broadcast address\n     *   to query for id of the node at that address. This determines whether the endpoint still\n     *   belongs to that same node (which is/was a CMS member).\n     * 2. While we don't have confirmed current addresses for a majority of CMS nodes:","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/Startup.java#L227-L263","documentation":"During non-CMS startup, Startup.initializeAsNonCmsNode verifies with an existing cluster member that the NodeId/HostId the cluster has recorded for this node's broadcast address matches the locally persisted nodeId. On mismatch it throws this IllegalStateException, explicitly warning about a possible IP address collision: two different nodes have claimed (or are claiming) the same broadcast address, or the local hostid file is stale relative to cluster state.","triggerScenarios":"initializeAsNonCmsNode fetches the remote view and finds currentHostId != nodeId.toUUID(); the node's IP was reassigned to different hardware; a stale hostid file persisted locally conflicts with the cluster's registration; the broadcast_address configuration was changed to overlap another node.","commonSituations":"IP reuse after replacing a node without decommissioning the old one; VM/container IPs recycled between clusters; restored node reusing an old data directory on an address already taken; DNS/hostname resolution pointing multiple nodes at one address.","solutions":["Confirm no other live node holds this broadcast address (nodetool status / system.peers_v2 on a healthy node).","If this is genuinely a new node on a reused IP, remove the stale cluster registration: decommission the dead node or use cms REMOVENODE for the old hostid.","Delete the stale local hostid file (hostid.txt in the data directory) only if this node is truly a fresh member, then restart so it registers anew.","Fix broadcast_address/broadcast_and_listen configuration so the address is unique in the cluster.","Never edit cluster metadata directly while both nodes are live — take one of them down first."],"exampleFix":"// before: node reuses an address already registered to another hostid\ncassandra-env: BROADCAST=10.0.0.7  // cluster has 10.0.0.7 -> hostid X, local hostid Y\n// after: unique address or cleaned registration\nBROADCAST=10.0.0.42  // or: remove old node (hostid X) before starting this one","handlingStrategy":"validation","validationCode":"// before startup, verify no other node claims this IP with a different hostid\nUUID local = FBUtilities.getBroadcastAddressAndPort().equals(addr) ? ClusterMetadataService.instance().hostIdFor(addr) : null;\nif (local != null && !local.equals(localHostId)) throw new IllegalStateException(\"Address collision detected\");","typeGuard":null,"tryCatchPattern":"try { Startup.initializeAsNonCmsNode(...); }\ncatch (IllegalStateException e) {\n    if (e.getMessage().contains(\"IP address collision\")) {\n        // halt startup, alert operator: do NOT delete hostid blindly\n        failFast(e);\n    } else throw e;\n}","preventionTips":["Decommission dead nodes before reusing their IPs","Keep hostid files with their nodes; never copy data dirs between nodes","Use unique, non-recycled addresses (or clear registrations) in virtualized environments","Cross-check nodetool status against planned broadcast addresses"],"tags":["tcm","nodeid","ip-collision","startup"],"backgroundTag":"invalid-argument-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}