{"record":{"id":"05f2396a21720d60","repo":"dotnet/orleans","slug":"could-not-find-cluster-version-entry-for-this-pa","errorCode":null,"errorMessage":"Could not find cluster version entry for {this._partitionId}","messagePattern":"Could not find cluster version entry for (.+?)","errorType":"exception","errorClass":"KeyNotFoundException","httpStatus":null,"severity":"critical","filePath":"src/Google/Orleans.Clustering.Firestore/FirestoreMembershipTable.cs","lineNumber":87,"sourceCode":"            .Chunk(FirestoreDataManager.MaxBatchSize)\n            .Select(chunk => this._storage.DeleteEntities(chunk)));\n    }\n\n    public async Task<MembershipTableData> ReadRow(SiloAddress key)\n    {\n        try\n        {\n            var collection = this._storage.GetCollection();\n            var data = await this._storage.ExecuteTransaction(async transaction =>\n            {\n                var versionSnapshot = await transaction.GetSnapshotAsync(\n                    collection.Document(this._partitionId),\n                    transaction.CancellationToken);\n                var siloSnapshot = await transaction.GetSnapshotAsync(\n                    collection.Document(key.ToParsableString()),\n                    transaction.CancellationToken);\n                if (!versionSnapshot.Exists)\n                    throw new KeyNotFoundException($\"Could not find cluster version entry for {this._partitionId}\");\n\n                var silos = siloSnapshot.Exists\n                    ? new[] { siloSnapshot.ConvertTo<SiloInstanceEntity>() }\n                    : Array.Empty<SiloInstanceEntity>();\n                return (silos, versionSnapshot.ConvertTo<ClusterVersionEntity>());\n            });\n\n            var table = Convert(data);\n\n            LogReadEntry(key, table);\n\n            return table;\n        }\n        catch (Exception exc)\n        {\n            LogReadEntryError(exc, key);\n            throw;\n        }","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Google/Orleans.Clustering.Firestore/FirestoreMembershipTable.cs#L69-L105","documentation":"KeyNotFoundException from FirestoreMembershipTable.ReadRow when the cluster-version document (identified by the sanitized ClusterId, _partitionId) does not exist in the Firestore collection at read time. Membership reads require the version entry to exist; its absence means the membership table was never initialized (TryCreateTableVersionEntry did not run or did not persist). The throw happens inside the transaction after both snapshots are fetched.","triggerScenarios":"ReadRow(key) executes a transaction; the versionSnapshot for collection.Document(_partitionId).Exists is false. This occurs when InitializeMembershipTable was called with tryInitTableVersion=false, when the version doc was deleted, or when the Firestore project/collection points to a different deployment than where the cluster version was created.","commonSituations":"A fresh Firestore collection with no version doc and a silo that did not (or could not) create one; a split-brain where two silos target different Firestore projects/keyspaces; accidental deletion of the cluster version document; or reading membership before the first silo has initialized the version entry.","solutions":["Ensure the first silo in the cluster calls InitializeMembershipTable(tryInitTableVersion: true) so TryCreateTableVersionEntry creates the version doc.","Verify FirestoreOptions (project id, collection prefix, emulator vs. production) point to the same collection where the cluster version should live.","If the version doc was deleted, re-initialize the membership table (or let a silo recreate it) before issuing read requests.","Confirm the ClusterId used by all silos matches; _partitionId is Utils.SanitizeId(ClusterId), so a mismatched ClusterId yields a different version doc."],"exampleFix":"// before\nvar membership = host.Services.GetRequiredService<IMembershipTable>();\nawait membership.ReadRow(siloAddr); // throws if version doc absent\n\n// after\nvar membership = host.Services.GetRequiredService<IMembershipTable>();\nawait membership.InitializeMembershipTable(tryInitTableVersion: true); // ensures version doc exists\nawait membership.ReadRow(siloAddr);","handlingStrategy":"validation","validationCode":"await membership.InitializeMembershipTable(tryInitTableVersion: true);\n// verify FirestoreOptions point to the intended project/collection\n// and that ClusterId is consistent across all silos\nawait membership.ReadRow(key);","typeGuard":null,"tryCatchPattern":"try { await membership.ReadRow(key); }\ncatch (KeyNotFoundException ex) when (ex.Message.Contains(\"cluster version entry\"))\n{ logger.LogCritical(ex, \"Membership version doc missing; reinitialize the table\"); throw; }","preventionTips":["Ensure the first silo initializes with tryInitTableVersion: true","Keep FirestoreOptions (project/collection) consistent across silos","Do not manually delete the cluster version document"],"tags":["firestore","clustering","membership","initialization","config"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}