{"record":{"id":"682c99f43e15ada6","repo":"dotnet/orleans","slug":"the-journal-id-must-not-be-the-default-value-682c99","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/AzureBlobJournalStorageOptions.cs","lineNumber":101,"sourceCode":"\n    /// <summary>\n    /// Gets or sets the upper bound on the per-attempt backoff used by metadata-only conflict\n    /// retries. The exponential schedule starts at <see cref=\"MetadataOnlyConflictInitialBackoff\"/>\n    /// and never exceeds this value. Defaults to 200 ms.\n    /// </summary>\n    public TimeSpan MetadataOnlyConflictMaxBackoff { get; set; } = DEFAULT_METADATA_ONLY_CONFLICT_MAX_BACKOFF;\n    public static readonly TimeSpan DEFAULT_METADATA_ONLY_CONFLICT_MAX_BACKOFF = TimeSpan.FromMilliseconds(200);\n\n    /// <summary>\n    /// The optional delegate used to create a <see cref=\"BlobServiceClient\"/> instance.\n    /// </summary>\n    internal Func<CancellationToken, Task<BlobServiceClient>>? CreateClient { get; private set; }\n\n    internal string GetWalBlobNameForJournal(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        var blobName = GetWalBlobName(journalId);\n        ArgumentException.ThrowIfNullOrWhiteSpace(blobName);\n        return blobName;\n    }\n\n    internal string GetCheckpointBlobNameForJournal(JournalId journalId, string snapshotId)\n    {\n        if (journalId.IsDefault)\n        {\n            throw new ArgumentException(\"The journal id must not be the default value.\", nameof(journalId));\n        }\n\n        ArgumentException.ThrowIfNullOrWhiteSpace(snapshotId);\n        var blobName = GetCheckpointBlobName(journalId, snapshotId);\n        ArgumentException.ThrowIfNullOrWhiteSpace(blobName);\n        return blobName;","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageOptions.cs#L83-L119","documentation":"Thrown by AzureBlobJournalStorageOptions.GetWalBlobNameForJournal when the supplied JournalId is the default(uninitialized) value. The JournalId forms the root of the blob name; a default journal id has no value and would map all uninitialized callers to the same blob, corrupting concurrent journals. The guard prevents that.","triggerScenarios":"Calling GetWalBlobNameForJournal with a JournalId created via 'default' or 'new JournalId()' without assigning a value. The check is the first statement in the method.","commonSituations":"Default-structuring a JournalId field and forgetting to initialize it; deserializing a JournalId from JSON that yields the default; passing a JournalId before it has been created or listed.","solutions":["Always construct a JournalId from a non-empty string: new JournalId(\"myJournal\").","Initialize JournalId fields at construction time, not as default(JournalId).","When receiving a JournalId from an external source, validate journalId.IsDefault before passing it to storage APIs."],"exampleFix":"// before\nvar id = default(JournalId);\nvar blobName = options.GetWalBlobNameForJournal(id);\n\n// after\nvar id = new JournalId(\"orders-journal\");\nvar blobName = options.GetWalBlobNameForJournal(id);","handlingStrategy":"type-guard","validationCode":"if (journalId.IsDefault) throw new InvalidOperationException(\"JournalId not initialized.\");\nvar blobName = options.GetWalBlobNameForJournal(journalId);","typeGuard":"static bool IsUsableJournalId(JournalId id) => !id.IsDefault;","tryCatchPattern":null,"preventionTips":["Initialize JournalId from a deterministic non-empty string at grain activation.","Guard every storage entry point with journalId.IsDefault.","Avoid default(JournalId) in field initializers."],"tags":["azure-blob-storage","journal-id","validation","argument"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}