{"record":{"id":"04fd7e42110e4ee2","repo":"vectordotdev/vector","slug":"record-was-already-validated","errorCode":null,"errorMessage":"record was already validated","messagePattern":"record was already validated","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/vector-buffers/src/variants/disk_v2/checkpoint_recovery.rs","lineNumber":458,"sourceCode":"            Ok(data_file_mmap) => data_file_mmap,\n            Err(e) if e.kind() == ErrorKind::NotFound => {\n                error!(\n                    data_file_id,\n                    \"Missing checkpointed data file before unread boundary; treating records as lost.\"\n                );\n                return Ok(DataFileClassification::Missing);\n            }\n            Err(e) => return Err(ReaderError::Io { source: e }),\n        };\n\n        if data_file_mmap.as_ref().is_empty() {\n            return Ok(DataFileClassification::Empty);\n        }\n\n        match validate_record_archive(data_file_mmap.as_ref(), &Hasher::new()) {\n            RecordStatus::Valid { id: last_record_id } => {\n                let record = try_as_record_archive(data_file_mmap.as_ref())\n                    .expect(\"record was already validated\");\n                let item = match decode_record_payload::<T>(record) {\n                    Ok(item) => item,\n                    Err(error) => {\n                        warn!(\n                            data_file_id,\n                            %error,\n                            \"Final checkpoint record could not be decoded; scanning file boundary.\"\n                        );\n                        return Ok(DataFileClassification::NeedsBoundaryScan);\n                    }\n                };\n                let record_events =\n                    u64::try_from(item.event_count()).expect(\"event count should never exceed u64\");\n                Ok(DataFileClassification::KnownLastRecord {\n                    last_record_id: last_record_id + record_events.saturating_sub(1),\n                })\n            }\n            RecordStatus::Corrupted { .. } => {","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/vector-buffers/src/variants/disk_v2/checkpoint_recovery.rs#L440-L476","documentation":"While classifying the final data file during disk_v2 checkpoint recovery, Vector first validates the record archive (checksum) and only re-parses it with `try_as_record_archive` after validation returned `RecordStatus::Valid`. The second parse is expected to succeed because validation already succeeded; if the two parsers disagree, this invariant panic aborts recovery. There is no configuration that legitimately produces the disagreement.","triggerScenarios":"Recovery encountering a data file that passes `validate_record_archive` but then fails `try_as_record_archive` — realistically only via memory/hardware corruption or a genuine parser-disagreement bug in Vector; triggered at sink buffer construction when the final data file is scanned.","commonSituations":"Extremely rare; appears after unclean shutdowns or on flaky hardware where recovery lands on a torn state; otherwise it indicates an internal Vector bug worth reporting with the data file.","solutions":["Move the buffer data directory aside and restart so the buffer is recreated (drops buffered events)","Re-run with RUST_BACKTRACE=1 and preserve the original data files for the report","File an upstream issue with the Vector version, backtrace, and (if shareable) the offending data file"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Preserve buffer data directories across restarts on stable storage; avoid hard kills during heavy buffered writes","Keep a runbook step to move the data directory aside and restart when recovery panics loop","Save the moved-aside files until an upstream triage confirms whether they are needed"],"tags":["rust","vector","disk-buffer","checkpoint","invariant","panic"],"backgroundTag":"disk-buffer-checkpoint-corruption","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}