{"record":{"id":"b85c9ba272147823","repo":"dotnet/orleans","slug":"cluster-id-clusterid-does-not-match-cassandraclu","errorCode":null,"errorMessage":"Cluster id {clusterId} does not match CassandraClusteringTable value of '{_clusterOptions.ClusterId}'.","messagePattern":"Cluster id (.+?) does not match CassandraClusteringTable value of '(.+?)'\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Cassandra/Orleans.Clustering.Cassandra/CassandraClusteringTable.cs","lineNumber":62,"sourceCode":"        _session = await _options.CreateSessionAsync(_serviceProvider);\n        if (_session is null)\n        {\n            throw new InvalidOperationException($\"Session created from configuration '{nameof(CassandraClusteringOptions)}' is null.\");\n        }\n\n        _queries = await OrleansQueries.CreateInstance(_session);\n\n        await _queries.EnsureTableExistsAsync(_options.InitializeRetryMaxDelay, _ttlSeconds);\n\n        if (tryInitTableVersion)\n            await _queries.EnsureClusterVersionExistsAsync(_options.InitializeRetryMaxDelay, _identifier);\n    }\n\n    async Task IMembershipTable.DeleteMembershipTableEntries(string clusterId)\n    {\n        if (string.Compare(clusterId, _clusterOptions.ClusterId, StringComparison.InvariantCultureIgnoreCase) != 0)\n        {\n            throw new ArgumentException(\n                $\"Cluster id {clusterId} does not match CassandraClusteringTable value of '{_clusterOptions.ClusterId}'.\",\n                nameof(clusterId));\n        }\n\n        await Session.ExecuteAsync(await Queries.DeleteMembershipTableEntries(_identifier));\n    }\n\n    async Task<bool> IMembershipTable.InsertRow(MembershipEntry entry, TableVersion tableVersion)\n    {\n        // Prevent duplicate rows\n        var existingRow = await ((IMembershipTable)this).ReadRow(entry.SiloAddress);\n        if (existingRow is not null)\n        {\n            if (existingRow.Version.Version >= tableVersion.Version)\n            {\n                return false;\n            }\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Cassandra/Orleans.Clustering.Cassandra/CassandraClusteringTable.cs#L44-L80","documentation":"ArgumentException from DeleteMembershipTableEntries when the clusterId argument does not match the configured ClusterId (case-insensitive, InvariantCulture). The table is partitioned/identified by ClusterId, so deleting entries for a different cluster id is rejected to prevent cross-cluster data loss.","triggerScenarios":"Calling IMembershipTable.DeleteMembershipTableEntries(clusterId) with a clusterId that differs from IOptions<ClusterOptions>.ClusterId used to construct the table. The comparison uses string.Compare with InvariantCultureIgnoreCase.","commonSituations":"Calling DeleteMembershipTableEntries with a stale/hardcoded cluster id after renaming the cluster, or a management tool passing a cluster id from config that doesn't match the silo's ClusterOptions. Case differences are tolerated, but any other difference throws.","solutions":["Pass the same ClusterId that is configured in ClusterOptions (resolve IOptions<ClusterOptions> and use its ClusterId).","Align your tooling's cluster id with the running silo's configured cluster id before issuing a delete.","Avoid hardcoding cluster ids; source them from the same configuration the silo uses."],"exampleFix":"// before\nawait table.DeleteMembershipTableEntries(\"old-cluster\"); // throws\n\n// after\nvar clusterId = host.Services.GetRequiredService<IOptions<ClusterOptions>>().Value.ClusterId;\nawait table.DeleteMembershipTableEntries(clusterId);","handlingStrategy":"validation","validationCode":"var clusterId = host.Services.GetRequiredService<IOptions<ClusterOptions>>().Value.ClusterId;\nif (!string.Equals(clusterId, configured, StringComparison.InvariantCultureIgnoreCase))\n    throw new ArgumentException(\"cluster id mismatch\");\nawait table.DeleteMembershipTableEntries(clusterId);","typeGuard":"static bool ClusterIdMatches(string a, string b) =>\n    string.Equals(a, b, StringComparison.InvariantCultureIgnoreCase);","tryCatchPattern":null,"preventionTips":["Source the cluster id from ClusterOptions, not a hardcoded constant","Align tooling's cluster id with the running silo","Avoid renaming the cluster without coordinated cleanup"],"tags":["cassandra","clustering","argument-validation","config"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}