dotnet/orleans · error · InvalidOperationException

Azure Table journal header count or length properties are in

Error message

Azure Table journal header count or length properties are invalid.

What it means

The header row's RowCount or Length property is missing or negative. CreateHeaderState (AzureTableJournalStorage.cs:1014-1015) reads them via GetInt64 (which returns null when absent) and the guard `rowCount is not >= 0 || length is not >= 0` fails for both null and negative values. These counters bound data-row iteration, so invalid values make the journal unreadable.

Source

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

        }

        return names;
    }

    private HeaderState CreateHeaderState(TableEntity entity)
    {
        ValidateHeaderJournalId(entity);
        var generation = entity.GetString(GenerationPropertyName);
        if (generation is not { Length: > 0 })
        {
            throw new InvalidOperationException("Azure Table journal header is missing its generation property.");
        }

        var rowCount = entity.GetInt64(RowCountPropertyName);
        var length = entity.GetInt64(LengthPropertyName);
        if (rowCount is not >= 0 || length is not >= 0)
        {
            throw new InvalidOperationException("Azure Table journal header count or length properties are invalid.");
        }

        // Headers written by the original provider schema did not have separate compaction counters.
        // Conservatively treat the current generation as uncompacted until the next replacement resets them.
        var appendRowCount = entity.GetInt64(AppendRowCountPropertyName) ?? rowCount.Value;
        var appendLength = entity.GetInt64(AppendLengthPropertyName) ?? length.Value;
        if (appendRowCount < 0 || appendLength < 0)
        {
            throw new InvalidOperationException("Azure Table journal header count or length properties are invalid.");
        }

        return new HeaderState(
            entity.ETag,
            new HeaderProviderState(
                NormalizeFormat(entity.GetString(FormatPropertyName)),
                generation,
                rowCount.Value,
                length.Value,

View on GitHub (pinned to fca799fa70)

Solutions

  1. Delete or repair the $header row so RowCount and Length are present and non-negative.
  2. Confirm no tooling mutates the $header entity outside the provider.
  3. Trigger a journal Replace to publish a fresh, fully-populated header.
Defensive patterns

Strategy: try-catch

Try / catch

try { /* read header */ }
catch (InvalidOperationException ex) when (ex.Message.Contains("count or length properties are invalid"))
{
    // Repair or reset the $header row.
}

Prevention

When it happens

Trigger: Reading the header when RowCount and/or Length is absent or < 0; thrown at AzureTableJournalStorage.cs:1018.

Common situations: External edit removed or negated RowCount/Length; a partial header write by a non-provider tool; schema drift where a field was renamed; legacy header that predates one of these required columns being treated as required.

Related errors


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