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 AzureTableJournalStorage constructor when the JournalId is default. Each journal maps to one Azure Table partition keyed off the journal id; a default id has no value and cannot produce a partition key. The guard runs before any field assignment.

Source

Thrown at src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs:84

    private readonly string _partitionKey;
    private TableClient? _tableClient;
    private ETag _headerETag;
    private HeaderProviderState _headerProviderState;

    private bool HeaderExists => _headerETag != default;

    public bool IsCompactionRequested
        => _headerProviderState.AppendRowCount >= _shared.Options.CompactionRowCountThreshold
            || _headerProviderState.AppendLength >= _shared.Options.CompactionSizeThreshold;

    internal AzureTableJournalStorage(
        AzureTableJournalStorageShared shared,
        JournalId journalId)
    {
        ArgumentNullException.ThrowIfNull(shared);
        if (journalId.IsDefault)
        {
            throw new ArgumentException("The journal id must not be the default value.", nameof(journalId));
        }

        _shared = shared;
        _journalId = journalId;
        _partitionKey = shared.Options.GetPartitionKeyForJournal(journalId);
    }

    private TableClient Table => _tableClient ??= GetTableClient();

    public async ValueTask<bool> CreateIfNotExistsAsync(
        IReadOnlyDictionary<string, string>? metadata = null,
        CancellationToken cancellationToken = default)
    {
        var startTimestamp = Stopwatch.GetTimestamp();
        var succeeded = false;
        var callerMetadata = CopyAndValidateCallerMetadata(metadata);
        try
        {

View on GitHub (pinned to fca799fa70)

Solutions

  1. Construct the JournalId from a non-empty string: new JournalId("myJournal").
  2. Validate journalId.IsDefault before constructing storage.
  3. Initialize JournalId fields at construction time.

Example fix

// before
var storage = new AzureTableJournalStorage(shared, default(JournalId));

// after
var storage = new AzureTableJournalStorage(shared, new JournalId("myJournal"));
Defensive patterns

Strategy: type-guard

Validate before calling

if (journalId.IsDefault) throw new InvalidOperationException("JournalId not initialized.");
var storage = new AzureTableJournalStorage(shared, journalId);

Type guard

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

Prevention

When it happens

Trigger: Constructing AzureTableJournalStorage (directly or via a table-based provider) with default(JournalId). The check is the second statement in the constructor.

Common situations: Default-structuring a JournalId; deserializing a JournalId that yields default; passing an uninitialized id from a grain activation path.

Related errors


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