dotnet/orleans · error · ArgumentException

The journal id must not be the default value.

Error message

The journal id must not be the default value.

What it means

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.

Source

Thrown at src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageOptions.cs:101

    /// <summary>
    /// Gets or sets the upper bound on the per-attempt backoff used by metadata-only conflict
    /// retries. The exponential schedule starts at <see cref="MetadataOnlyConflictInitialBackoff"/>
    /// and never exceeds this value. Defaults to 200 ms.
    /// </summary>
    public TimeSpan MetadataOnlyConflictMaxBackoff { get; set; } = DEFAULT_METADATA_ONLY_CONFLICT_MAX_BACKOFF;
    public static readonly TimeSpan DEFAULT_METADATA_ONLY_CONFLICT_MAX_BACKOFF = TimeSpan.FromMilliseconds(200);

    /// <summary>
    /// The optional delegate used to create a <see cref="BlobServiceClient"/> instance.
    /// </summary>
    internal Func<CancellationToken, Task<BlobServiceClient>>? CreateClient { get; private set; }

    internal string GetWalBlobNameForJournal(JournalId journalId)
    {
        if (journalId.IsDefault)
        {
            throw new ArgumentException("The journal id must not be the default value.", nameof(journalId));
        }

        var blobName = GetWalBlobName(journalId);
        ArgumentException.ThrowIfNullOrWhiteSpace(blobName);
        return blobName;
    }

    internal string GetCheckpointBlobNameForJournal(JournalId journalId, string snapshotId)
    {
        if (journalId.IsDefault)
        {
            throw new ArgumentException("The journal id must not be the default value.", nameof(journalId));
        }

        ArgumentException.ThrowIfNullOrWhiteSpace(snapshotId);
        var blobName = GetCheckpointBlobName(journalId, snapshotId);
        ArgumentException.ThrowIfNullOrWhiteSpace(blobName);
        return blobName;

View on GitHub (pinned to fca799fa70)

Solutions

  1. Always construct a JournalId from a non-empty string: new JournalId("myJournal").
  2. Initialize JournalId fields at construction time, not as default(JournalId).
  3. When receiving a JournalId from an external source, validate journalId.IsDefault before passing it to storage APIs.

Example fix

// before
var id = default(JournalId);
var blobName = options.GetWalBlobNameForJournal(id);

// after
var id = new JournalId("orders-journal");
var blobName = options.GetWalBlobNameForJournal(id);
Defensive patterns

Strategy: type-guard

Validate before calling

if (journalId.IsDefault) throw new InvalidOperationException("JournalId not initialized.");
var blobName = options.GetWalBlobNameForJournal(journalId);

Type guard

static bool IsUsableJournalId(JournalId id) => !id.IsDefault;

Prevention

When it happens

Trigger: Calling GetWalBlobNameForJournal with a JournalId created via 'default' or 'new JournalId()' without assigning a value. The check is the first statement in the method.

Common situations: 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.

Related errors


AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13). Data as JSON: /api/errors/682c99f43e15ada6. Report an issue: GitHub.