{"record":{"id":"c744c089b3cc27e1","repo":"dotnet/orleans","slug":"the-journal-id-must-not-be-the-default-value-c744c0","errorCode":null,"errorMessage":"The journal id must not be the default value.","messagePattern":"The journal id must not be the default value\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorageProvider.cs","lineNumber":53,"sourceCode":"\n    private async Task Initialize(CancellationToken cancellationToken)\n    {\n        var createClient = _options.CreateClient\n            ?? throw new InvalidOperationException(\n                $\"No Azure Table service client was configured. Set {nameof(AzureTableJournalStorageOptions.TableServiceClient)} \" +\n                $\"or call {nameof(AzureTableJournalStorageOptions.ConfigureTableServiceClient)}.\");\n        var client = await createClient(cancellationToken).ConfigureAwait(false)\n            ?? throw new InvalidOperationException(\"The configured Azure Table service client factory returned null.\");\n        var table = client.GetTableClient(_options.TableName);\n        await table.CreateIfNotExistsAsync(cancellationToken).ConfigureAwait(false);\n        _tableClientProvider.SetTableClient(table);\n    }\n\n    public IJournalStorage CreateStorage(JournalId journalId)\n    {\n        if (journalId.IsDefault)\n        {\n            throw new ArgumentException(\"The journal id must not be the default value.\", nameof(journalId));\n        }\n\n        return new AzureTableJournalStorage(_shared, journalId);\n    }\n\n    public async IAsyncEnumerable<JournalId> ListAsync(\n        JournalId prefix = default,\n        [EnumeratorCancellation] CancellationToken cancellationToken = default)\n    {\n        var table = _tableClientProvider.GetTableClient();\n        var filter = TableClient.CreateQueryFilter($\"RowKey eq {AzureTableJournalStorage.HeaderRowKey}\");\n        var journalIds = new List<JournalId>();\n        await foreach (var entity in table.QueryAsync<TableEntity>(filter, select: JournalIdSelect, cancellationToken: cancellationToken))\n        {\n            if (TryGetJournalId(entity, out var journalId) && prefix.IsPrefixOf(journalId))\n            {\n                journalIds.Add(journalId);\n            }","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorageProvider.cs#L35-L71","documentation":"Thrown by AzureTableJournalStorageProvider.CreateStorage when the supplied JournalId is the default value. The provider cannot create a journal storage instance for an uninitialized id, since the partition key and all rows are keyed off the JournalId.","triggerScenarios":"Calling provider.CreateStorage(default) or passing a JournalId whose IsDefault is true (empty/unset Value).","commonSituations":"A journaled grain tries to open its storage before its id is assigned; test scaffolding passes default(JournalId); a deserialization step leaves the id default.","solutions":["Ensure the JournalId is constructed with a non-empty Value before calling CreateStorage.","Guard the call site: if (journalId.IsDefault) return/skip.","Trace where the default id originates (uninitialized field, missing constructor argument)."],"exampleFix":"// before\nvar storage = provider.CreateStorage(default(JournalId));\n// after\nif (journalId.IsDefault) throw new ArgumentException(\"id required\", nameof(journalId));\nvar storage = provider.CreateStorage(journalId);","handlingStrategy":"validation","validationCode":"if (journalId.IsDefault) throw new ArgumentException(\"id required\", nameof(journalId));\nvar storage = provider.CreateStorage(journalId);","typeGuard":"static bool IsValidJournalId(JournalId id) => !id.IsDefault;","tryCatchPattern":null,"preventionTips":["Assign the JournalId during grain activation, before any storage call.","Boundary-check IsDefault before CreateStorage.","Avoid default(JournalId) in tests except where you intend to assert the throw."],"tags":["azure-table-storage","journaling","journal-id","validation"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}