{"record":{"id":"306b697ccdc6c58a","repo":"vectordotdev/vector","slug":"event-count-should-never-exceed-u64","errorCode":null,"errorMessage":"event count should never exceed u64","messagePattern":"event count should never exceed u64","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"lib/vector-buffers/src/variants/disk_v2/checkpoint_recovery.rs","lineNumber":471,"sourceCode":"        }\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 { .. } => {\n                warn!(\n                    data_file_id,\n                    \"Final checkpoint record has an invalid checksum; scanning file boundary.\"\n                );\n                Ok(DataFileClassification::NeedsBoundaryScan)\n            }\n            RecordStatus::FailedDeserialization(error) => {\n                warn!(\n                    data_file_id,\n                    ?error,\n                    \"Final checkpoint record could not be deserialized; scanning file boundary.\"\n                );\n                Ok(DataFileClassification::NeedsBoundaryScan)","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/vector-buffers/src/variants/disk_v2/checkpoint_recovery.rs#L453-L489","documentation":"After decoding the final checkpoint record during disk_v2 recovery, Vector converts the record's event count (a platform `usize`) into `u64` to compute the last known record ID. On every supported platform `usize` is at most 64 bits, so the conversion is total; the expect is a documented-impossible assertion guarding hypothetical >64-bit targets. Seeing it means memory corruption or an unsupported platform, not a data or config problem.","triggerScenarios":"u64::try_from(item.event_count()) failing, which requires a `usize` wider than u64 (no supported Rust target); no Vector configuration or on-disk state can trigger it.","commonSituations":"None in practice; the panic would only appear alongside hardware faults or a custom >64-bit target build.","solutions":["Treat as a bug: capture the backtrace and report it upstream","If panics cluster, rule out memory/hardware instability (memtest, cgroup OOM behavior, ECC errors)","Move the buffer data directory aside to return to service"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["No caller-side guard exists; the conversion is total on supported platforms","If observed, suspect hardware/memory instability and collect a backtrace for an upstream report"],"tags":["rust","vector","disk-buffer","invariant","integer-conversion","panic"],"backgroundTag":"integer-width-conversion-panic","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}