{"record":{"id":"a8f378f61446f1a8","repo":"apache/cassandra","slug":"cluster-metadata-identifier-mismatch-node-is-atte","errorCode":null,"errorMessage":"Cluster Metadata Identifier mismatch. Node is attempting to communicate with a node from a different cluster. Current identifier %d. Remote identifier: %d","messagePattern":"Cluster Metadata Identifier mismatch\\. Node is attempting to communicate with a node from a different cluster\\. Current identifier (.+?)\\. Remote identifier: (.+?)","errorType":"exception","errorClass":"CMSIdentifierMismatchException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/tcm/ClusterMetadata.java","lineNumber":1305,"sourceCode":"        return ClusterMetadataService.instance().metadata();\n    }\n\n    public static void checkIdentifier(int remoteIdentifier)\n    {\n        ClusterMetadata metadata = currentNullable();\n        if (metadata != null)\n        {\n            int currentIdentifier = metadata.metadataIdentifier;\n            // We haven't yet joined CMS fully\n            if (currentIdentifier == EMPTY_METADATA_IDENTIFIER)\n                return;\n\n            // Peer hasn't yet joined CMS fully\n            if (remoteIdentifier == EMPTY_METADATA_IDENTIFIER)\n                return;\n\n            if (currentIdentifier != remoteIdentifier)\n                throw new CMSIdentifierMismatchException(String.format(\"Cluster Metadata Identifier mismatch. Node is attempting to communicate with a node from a different cluster. Current identifier %d. Remote identifier: %d\", currentIdentifier, remoteIdentifier));\n        }\n    }\n\n    /**\n     * Startup of some services may race with cluster metadata initialization. We allow those services to\n     * gracefully handle scenarios when it is not yet initialized.\n     */\n    public static ClusterMetadata currentNullable()\n    {\n        ClusterMetadataService service = ClusterMetadataService.instance();\n        if (service == null)\n            return null;\n        return service.metadata();\n    }\n\n    public NodeId myNodeId()\n    {\n        return localNodeId;","sourceCodeStart":1287,"sourceCodeEnd":1323,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/ClusterMetadata.java#L1287-L1323","documentation":"When validating metadata exchanged with a peer, the node compares its current ClusterMetadata identifier against the remote one. A remote identifier equal to the sentinel EMPTY_METADATA_IDENTIFIER is tolerated (peer hasn't finished joining CMS), but any other mismatch means the two nodes belong to different logical clusters, and CMSIdentifierMismatchException is thrown to prevent cross-cluster communication.","triggerScenarios":"Receiving a message/metadata snapshot whose remote cluster identifier differs from the local one, where the remote identifier is not the empty sentinel. Typically during peer exchange after a bad join, restored-from-backup state, or split/parallel cluster formation.","commonSituations":"A node cloned from a different cluster, stale seeds pointing at another cluster, restored metadata log from a different cluster, or a node re-initialized with a new identifier while old peers still run the old one.","solutions":["Verify both nodes' cluster metadata identifiers match (logs show current vs remote).","If the node was cloned/restored from another cluster, re-bootstrap it correctly into the intended cluster.","Fix seed/contact configuration so nodes join the correct cluster.","Never reuse a data directory or commit log from a different cluster without cleaning TCM state."],"exampleFix":"// before\n// node joined with stale seed from another cluster\nseed_provider: [{seeds: \"10.0.0.5:7000\"}] // wrong cluster\n// after\nseed_provider: [{seeds: \"10.0.0.1:7000,10.0.0.2:7000\"}] // seeds of your cluster\n","handlingStrategy":"try-catch","validationCode":"if (remote.getIdentifier() != ClusterMetadata.current().metadataIdentifier\n    && remote.getIdentifier() != ClusterMetadata.EMPTY_METADATA_IDENTIFIER)\n    throw new CMSIdentifierMismatchException(\"Peer from a different cluster: \" + remote.getIdentifier());","typeGuard":null,"tryCatchPattern":"try {\n    messaging.exchangeMetadata(...);\n} catch (CMSIdentifierMismatchException e) {\n    logger.error(\"Cluster identity mismatch, halting communication: {}\", e.getMessage());\n    // stop messaging, alert operator\n}","preventionTips":["Never clone/restore data directories across clusters","Keep seed configuration consistent within one cluster","Monitor identifier values after restores or cluster rebuilds"],"tags":["cassandra","tcm","cluster-identity","peer-communication"],"backgroundTag":"cluster-identifier-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"}