{"record":{"id":"19949e86a09069a6","repo":"dotnet/orleans","slug":"the-journal-id-must-not-be-the-default-value-19949e","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/DefaultBlobContainerFactory.cs","lineNumber":21,"sourceCode":"namespace Orleans.Journaling;\n\n/// <summary>\n/// A default blob container factory that uses the default container name.\n/// </summary>\n/// <remarks>\n/// Initializes a new instance of the <see cref=\"DefaultBlobContainerFactory\"/> class.\n/// </remarks>\n/// <param name=\"options\">The blob storage options</param>\ninternal sealed class DefaultBlobContainerFactory(AzureBlobJournalStorageOptions options) : IBlobContainerFactory\n{\n    private BlobContainerClient _defaultContainer = null!;\n\n    /// <inheritdoc/>\n    public BlobContainerClient GetBlobContainerClient(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 _defaultContainer;\n    }\n\n    /// <inheritdoc/>\n    public async Task InitializeAsync(BlobServiceClient client, CancellationToken cancellationToken)\n    {\n        _defaultContainer = client.GetBlobContainerClient(options.ContainerName);\n        await _defaultContainer.CreateIfNotExistsAsync(cancellationToken: cancellationToken);\n    }\n}\n","sourceCodeStart":3,"sourceCodeEnd":34,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/DefaultBlobContainerFactory.cs#L3-L34","documentation":"Thrown by DefaultBlobContainerFactory.GetBlobContainerClient when the supplied JournalId is the default value. The blob container factory keys off the journal id (even though the default factory returns a shared container), so it refuses an uninitialized id to keep the contract consistent across factory implementations.","triggerScenarios":"Calling GetBlobContainerClient(default) or with a JournalId whose IsDefault is true, on the Azure Blob journaling path.","commonSituations":"A journaled grain accessing blob storage before its id is assigned; test code passing default(JournalId); a pipeline that resolves the container for an uninitialized journal.","solutions":["Construct the JournalId with a non-empty Value before requesting a container client.","Guard the call site with an IsDefault check.","Ensure the journal id is set during grain activation, not lazily after first storage access."],"exampleFix":"// before\nvar container = factory.GetBlobContainerClient(default);\n// after\nif (journalId.IsDefault) throw new ArgumentException(\"id required\", nameof(journalId));\nvar container = factory.GetBlobContainerClient(journalId);","handlingStrategy":"validation","validationCode":"if (journalId.IsDefault) throw new ArgumentException(\"id required\", nameof(journalId));\nvar container = factory.GetBlobContainerClient(journalId);","typeGuard":"static bool IsValidJournalId(JournalId id) => !id.IsDefault;","tryCatchPattern":null,"preventionTips":["Ensure the JournalId is set before blob container resolution.","Boundary-check IsDefault on the journaling/blob path.","Treat default(JournalId) as a sentinel, never a real key."],"tags":["azure-blob-storage","journaling","journal-id","validation"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}