{"record":{"id":"291b8a96cc70754d","repo":"dotnet/orleans","slug":"azure-table-journal-header-is-missing-its-generati","errorCode":null,"errorMessage":"Azure Table journal header is missing its generation property.","messagePattern":"Azure Table journal header is missing its generation property\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs","lineNumber":1011,"sourceCode":"\n    private static string[] CreateChunkPropertyNames()\n    {\n        var names = new string[MaxChunksPerEntity];\n        for (var i = 0; i < names.Length; i++)\n        {\n            names[i] = string.Create(CultureInfo.InvariantCulture, $\"Data{i:D2}\");\n        }\n\n        return names;\n    }\n\n    private HeaderState CreateHeaderState(TableEntity entity)\n    {\n        ValidateHeaderJournalId(entity);\n        var generation = entity.GetString(GenerationPropertyName);\n        if (generation is not { Length: > 0 })\n        {\n            throw new InvalidOperationException(\"Azure Table journal header is missing its generation property.\");\n        }\n\n        var rowCount = entity.GetInt64(RowCountPropertyName);\n        var length = entity.GetInt64(LengthPropertyName);\n        if (rowCount is not >= 0 || length is not >= 0)\n        {\n            throw new InvalidOperationException(\"Azure Table journal header count or length properties are invalid.\");\n        }\n\n        // Headers written by the original provider schema did not have separate compaction counters.\n        // Conservatively treat the current generation as uncompacted until the next replacement resets them.\n        var appendRowCount = entity.GetInt64(AppendRowCountPropertyName) ?? rowCount.Value;\n        var appendLength = entity.GetInt64(AppendLengthPropertyName) ?? length.Value;\n        if (appendRowCount < 0 || appendLength < 0)\n        {\n            throw new InvalidOperationException(\"Azure Table journal header count or length properties are invalid.\");\n        }\n","sourceCodeStart":993,"sourceCodeEnd":1029,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs#L993-L1029","documentation":"The journal header row ($header) is missing its Generation property or it is empty. CreateHeaderState (AzureTableJournalStorage.cs:1008) requires a non-empty Generation because the generation string names the current data-row prefix (FormatRowKey at line 991). A header without it cannot address any data rows, so it is treated as corrupt.","triggerScenarios":"entity.GetString(GenerationPropertyName) returns null or empty string in CreateHeaderState; thrown at AzureTableJournalStorage.cs:1011 when reading the header during a Read, metadata update, or compaction check.","commonSituations":"An external edit deleted/blanked the Generation field; a legacy or partially-written header row was committed without all fields; a migration wrote a header row but omitted Generation.","solutions":["Delete the malformed $header row and let the journal reinitialize it on the next append/replace.","Ensure only AzureTableJournalStorage writes the $header row (it always sets Generation via CreateHeaderFlipPatch at line 958).","Restore from a known-good backup if the header cannot be regenerated."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* read header */ }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"missing its generation\"))\n{\n    // Delete $header and let the next append recreate it.\n}","preventionTips":["Only the provider should write the $header row.","Back up the header before migrations.","Validate header completeness after any migration."],"tags":["azure-table","data-corruption","journal","header"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}