{"record":{"id":"87e3e9c7d957029c","repo":"vectordotdev/vector","slug":"record-bytes-should-always-be-known","errorCode":null,"errorMessage":"record bytes should always be known","messagePattern":"record bytes should always be known","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"lib/vector-buffers/src/variants/disk_v2/reader.rs","lineNumber":654,"sourceCode":"            {\n                had_eligible_records = true;\n\n                match len {\n                    // Any marker with an assumed length implies a gap marker, which gets added\n                    // automatically and represents a portion of the record ID range that was\n                    // expected but missing. This is a long way of saying: we're missing records.\n                    //\n                    // We tally this up so that we can emit a single log event/set of metrics, as\n                    // there may be many gap markers and emitting for each of them could be very noisy.\n                    EligibleMarkerLength::Assumed(count) => {\n                        events_skipped = events_skipped\n                            .checked_add(count)\n                            .expect(\"skipping more than 2^64 events at a time is obviously a bug\");\n                    }\n                    // We got a valid marker representing a known number of events.\n                    EligibleMarkerLength::Known(len) => {\n                        // We specifically pass the size of the record, in bytes, as the marker data.\n                        let record_bytes = data.expect(\"record bytes should always be known\");\n\n                        records_acknowledged = records_acknowledged.checked_add(1).expect(\n                            \"acknowledging more than 2^64 records at a time is obviously a bug\",\n                        );\n                        events_acknowledged = events_acknowledged.checked_add(len).expect(\n                            \"acknowledging more than 2^64 events at a time is obviously a bug\",\n                        );\n                        bytes_acknowledged = bytes_acknowledged.checked_add(record_bytes).expect(\n                            \"acknowledging more than 2^64 bytes at a time is obviously a bug\",\n                        );\n                    }\n                }\n            }\n\n            // We successfully processed at least one record, so update our buffer and ledger accounting.\n            if had_eligible_records {\n                self.ledger\n                    .track_reads(events_acknowledged, bytes_acknowledged);","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/vector-buffers/src/variants/disk_v2/reader.rs#L636-L672","documentation":"For each acknowledged record marker with a known event count, the reader expect()s that the marker's byte-size payload (`data`) is present. Record markers are created in one place (reader.rs:521) always together with Some(record_bytes), so a Known-length marker without data cannot be constructed; the expect surfaces marker-construction regressions only.","triggerScenarios":"An EligibleMarker with EligibleMarkerLength::Known but data == None entering the record-acknowledgement loop — no code path constructs this shape; only an internal refactor bug or memory corruption trips it.","commonSituations":"None in practice; data-file markers (which legitimately carry None data) are consumed by a separate loop that never reads `data`.","solutions":["No user action; if it fires, capture the backtrace and report it upstream"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["No caller-side guard exists; markers are constructed with their byte size in the only creation site","Report any occurrence upstream with a backtrace"],"tags":["rust","vector","disk-buffer","invariant","panic"],"backgroundTag":"option-expect-panic","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}