{"record":{"id":"3e68b7b2138279c9","repo":"dotnet/orleans","slug":"the-journal-storage-consumer-did-not-read-all-supp","errorCode":null,"errorMessage":"The journal storage consumer did not read all supplied journal data.","messagePattern":"The journal storage consumer did not read all supplied journal data\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs","lineNumber":446,"sourceCode":"                    }\n\n                    rowCount++;\n                    bytes += ReadChunks(row, buffer, consumer, metadata);\n                }\n            }\n\n            if (rowCount != headerState.ProviderState.RowCount || bytes != headerState.ProviderState.Length)\n            {\n                // A concurrent replace can delete rows of the generation being read; the caller must recover.\n                throw CreateInconsistentHeaderStateException(\n                    \"Azure Table journal changed while reading; recovery is required.\",\n                    headerState.ETag);\n            }\n\n            consumer.Read(new JournalBufferReader(buffer.Reader, isCompleted: true), metadata);\n            if (buffer.Length > 0)\n            {\n                throw new InvalidOperationException(\"The journal storage consumer did not read all supplied journal data.\");\n            }\n\n            LogRead(_shared.Logger, bytes, Table.Name, _partitionKey);\n            succeeded = true;\n        }\n        finally\n        {\n            _shared.Instruments.OnOperationCompleted(\n                AzureTableJournalStorageInstruments.OperationRead,\n                Stopwatch.GetElapsedTime(startTimestamp),\n                bytes,\n                succeeded);\n        }\n    }\n\n    public async ValueTask ReplaceAsync(ReadOnlySequence<byte> value, CancellationToken cancellationToken)\n    {\n        var startTimestamp = Stopwatch.GetTimestamp();","sourceCodeStart":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs#L428-L464","documentation":"Thrown during AzureTableJournalStorage read when the consumer callback did not drain all bytes supplied to it via JournalBufferReader. After the storage layer feeds the consumer a completed buffer, it checks buffer.Length; any remaining bytes indicate the consumer stopped early, which would lose journal data. This is a contract violation by the consumer (the journaled-state machine), not a storage fault.","triggerScenarios":"The IJournalConsumer.Read callback returns before consuming all bytes in the supplied JournalBufferReader, leaving buffer.Length > 0. This is an internal contract violation surfaced during ReadAsync.","commonSituations":"A custom IJournalFormat or IJournalConsumer with a bug that short-circuits on a partial record; version mismatch between the format writer and reader; malformed payload that causes the consumer to throw internally and be swallowed.","solutions":["Ensure the consumer reads the buffer to completion (the contract requires consuming all bytes until isCompleted is true).","Update the IJournalFormat implementation to match the version that wrote the data.","If the data is genuinely corrupt, force a compaction to rewrite the generation from the last consistent checkpoint."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure your IJournalConsumer drains the buffer fully:\npublic void Read(JournalBufferReader reader, IReadOnlyDictionary<string,string>? metadata)\n{\n    while (reader.TryRead(out var record)) { /* process */ }\n    // reader must be exhausted before returning; storage asserts buffer.Length == 0.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always drain the JournalBufferReader to completion in your consumer.","Keep the format writer and reader versions in sync.","Add an integration test that round-trips a payload and asserts no leftover bytes."],"tags":["azure-table-storage","consumer","contract-violation","invalid-operation"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}