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 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.

Source

Thrown at src/Azure/Orleans.Journaling.AzureStorage/DefaultBlobContainerFactory.cs:21

namespace Orleans.Journaling;

/// <summary>
/// A default blob container factory that uses the default container name.
/// </summary>
/// <remarks>
/// Initializes a new instance of the <see cref="DefaultBlobContainerFactory"/> class.
/// </remarks>
/// <param name="options">The blob storage options</param>
internal sealed class DefaultBlobContainerFactory(AzureBlobJournalStorageOptions options) : IBlobContainerFactory
{
    private BlobContainerClient _defaultContainer = null!;

    /// <inheritdoc/>
    public BlobContainerClient GetBlobContainerClient(JournalId journalId)
    {
        if (journalId.IsDefault)
        {
            throw new ArgumentException("The journal id must not be the default value.", nameof(journalId));
        }

        return _defaultContainer;
    }

    /// <inheritdoc/>
    public async Task InitializeAsync(BlobServiceClient client, CancellationToken cancellationToken)
    {
        _defaultContainer = client.GetBlobContainerClient(options.ContainerName);
        await _defaultContainer.CreateIfNotExistsAsync(cancellationToken: cancellationToken);
    }
}

View on GitHub (pinned to fca799fa70)

Solutions

  1. Construct the JournalId with a non-empty Value before requesting a container client.
  2. Guard the call site with an IsDefault check.
  3. Ensure the journal id is set during grain activation, not lazily after first storage access.

Example fix

// before
var container = factory.GetBlobContainerClient(default);
// after
if (journalId.IsDefault) throw new ArgumentException("id required", nameof(journalId));
var container = factory.GetBlobContainerClient(journalId);
Defensive patterns

Strategy: validation

Validate before calling

if (journalId.IsDefault) throw new ArgumentException("id required", nameof(journalId));
var container = factory.GetBlobContainerClient(journalId);

Type guard

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

Prevention

When it happens

Trigger: Calling GetBlobContainerClient(default) or with a JournalId whose IsDefault is true, on the Azure Blob journaling path.

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

Related errors


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