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 AzureBlobJournalStorageProvider.CreateStorage when the JournalId is default. Each journal maps to a distinct Azure Blob; a default journal id has no value and cannot be addressed. CreateStorage is the entry point used by the journaled-state manager to obtain a per-journal storage handle.

Source

Thrown at src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageProvider.cs:52

            new AzureBlobJournalStorage.OptionsBlobClientProvider(_containerFactory, _options),
            instruments ?? AzureBlobJournalStorageInstruments.CreateForDirectConstruction(),
            mimeType: journalFormat.MimeType,
            journalFormatKey: journalFormatKey);
    }

    private async Task Initialize(CancellationToken cancellationToken)
    {
        var client = await _options.CreateClient!(cancellationToken);
        _defaultContainer = client.GetBlobContainerClient(_options.ContainerName);
        await _defaultContainer.CreateIfNotExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
        await _containerFactory.InitializeAsync(client, cancellationToken).ConfigureAwait(false);
    }

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

        return new AzureBlobJournalStorage(_shared, journalId);
    }

    public async IAsyncEnumerable<JournalId> ListAsync(
        JournalId prefix = default,
        [EnumeratorCancellation] CancellationToken cancellationToken = default)
    {
        var container = GetDefaultContainerClient();
        var blobPrefix = prefix.IsDefault ? null : prefix.Value;
        var journalIds = new List<JournalId>();
        await foreach (var item in container.GetBlobsAsync(
            traits: BlobTraits.None,
            states: BlobStates.None,
            prefix: blobPrefix,
            cancellationToken: cancellationToken))
        {

View on GitHub (pinned to fca799fa70)

Solutions

  1. Always construct the JournalId from a non-empty string before calling CreateStorage.
  2. Initialize the journal id during grain activation, before requesting storage.
  3. Validate journalId.IsDefault at the call site and fail early with a domain-specific error.

Example fix

// before
var storage = provider.CreateStorage(default(JournalId));

// after
var storage = provider.CreateStorage(new JournalId(this.GetGrainId().ToString()));
Defensive patterns

Strategy: type-guard

Validate before calling

if (journalId.IsDefault) throw new InvalidOperationException("JournalId not initialized before CreateStorage.");
var storage = provider.CreateStorage(journalId);

Type guard

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

Prevention

When it happens

Trigger: Calling provider.CreateStorage(default(JournalId)) or with a JournalId that was never assigned a value. The check is the first statement in the method.

Common situations: Default-structuring a JournalId field in a grain; passing an uninitialized id obtained from a deserialized object; a bug in grain activation that does not set the journal id before requesting storage.

Related errors


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