{"record":{"id":"e5892506b4afb113","repo":"apache/cassandra","slug":"hostid-read-from-local-system-table-does-not-match","errorCode":null,"errorMessage":"HostId read from local system table does not match the one recorded for this endpoint during initial cluster metadata conversion. Endpoint: %s, NodeId: %s, Recorded: %s, Local: %s","messagePattern":"HostId read from local system table does not match the one recorded for this endpoint during initial cluster metadata conversion\\. Endpoint: (.+?), NodeId: (.+?), Recorded: (.+?), Local: (.+?)","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/tcm/transformations/Register.java","lineNumber":198,"sourceCode":"                throw new IllegalStateException(\"Node has host id \"+localHostId+\" in system.local, but is not present in cluster metadata - not allowing this node to register. \" +\n                                                \"If a bootstrap of this node failed and was aborted with `nodetool abortbootstrap` it should also have its data removed before trying to rebootstrap.\");\n            NodeVersion dirVersion = directory.version(nodeId);\n\n            // If this is a node in the process of upgrading, update the host id in the system.local table\n            // TODO: when constructing the initial cluster metadata for upgrade, we include a mapping from\n            //      NodeId to the old HostId. We will need to use this lookup to map between the two for\n            //      hint delivery immediately following an upgrade.\n            if (dirVersion == null || !dirVersion.isUpgraded())\n            {\n                if (directory.hostId(nodeId).equals(localHostId))\n                {\n                    SystemKeyspace.setLocalHostId(nodeId.toUUID());\n                    logger.info(\"Updated local HostId from pre-upgrade version {} to the one which was pre-registered \" +\n                                \"during initial cluster metadata conversion {}\", localHostId, nodeId.toUUID());\n                }\n                else\n                {\n                    throw new RuntimeException(\"HostId read from local system table does not match the one recorded \" +\n                                               \"for this endpoint during initial cluster metadata conversion. \" +\n                                               String.format(\"Endpoint: %s, NodeId: %s, Recorded: %s, Local: %s\",\n                                                             FBUtilities.getBroadcastAddressAndPort(),\n                                                             nodeId,\n                                                             directory.hostId(nodeId),\n                                                             localHostId));\n                }\n            }\n            else\n            {\n                logger.info(\"Local id was already registered, retaining: {}\", localHostId);\n            }\n            return nodeId;\n        }\n    }\n\n    @Override\n    public String toString()","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/transformations/Register.java#L180-L216","documentation":"Thrown during upgrade-time registration when the host id stored in the node's local system.local does not match the host id recorded for this node's address in the initial cluster metadata conversion. The mismatch means the local node state and CMS directory disagree about node identity, which would corrupt membership tracking.","triggerScenarios":"register() during upgrade finds directory.peerId(broadcastAddress) non-null, but directory.hostId(nodeId) differs from the localHostId read from system.local (and it is not the pre-upgrade path that would update system.local).","commonSituations":"Upgrading to TCM-based metadata after system.local was regenerated from the wrong backup; cloning a node's data directory onto another node; mixed/incorrect restore procedures.","solutions":["Correct system.local host id to match the id recorded in cluster metadata (restore proper node data)","Verify you did not copy another node's data directory onto this host; restore this node's own data","If metadata is wrong, fix the CMS directory entry (cms tool) or remove and re-register the node"],"exampleFix":"// before: restored wrong snapshot, system.local hostId=uuid-A but CMS says uuid-B\n// after: restore the node's own data so system.local hostId matches directory.hostId(nodeId),\n// or run: cqlsh> UPDATE system.local SET host_id = <uuid-from-cms> WHERE key='local';","handlingStrategy":"validation","validationCode":"// before upgrade registration, compare ids\nUUID localId = SystemKeyspace.getLocalHostId();\nUUID recordedId = directory.hostId(directory.peerId(broadcastAddress));\nif (localId != null && recordedId != null && !localId.equals(recordedId)) { /* fix before proceeding */ }","typeGuard":null,"tryCatchPattern":"try { register(); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"HostId read from local system table does not match\")) { /* restore correct node data or fix CMS entry */ } else throw e; }","preventionTips":["Never copy one node's data directory to another host","During upgrades, back up system.local per node and restore only the node's own backup","Cross-check host ids against CMS after any data restore"],"tags":["upgrade","host-id-mismatch","cluster-metadata"],"backgroundTag":"checksum-mismatch","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"}