{"record":{"id":"d1c9ed90af5bacdf","repo":"influxdata/influxdb","slug":"invalid-record-length-length","errorCode":null,"errorMessage":"invalid record length: {length}","messagePattern":"invalid record length: (.+?)","errorType":"error_code","errorClass":"FormatError","httpStatus":null,"severity":"critical","filePath":"influxdb3_catalog/src/format/mod.rs","lineNumber":195,"sourceCode":"\n    /// Buffer too short for required data.\n    #[error(\"buffer too short: expected at least {expected} bytes, got {actual}\")]\n    BufferTooShort { expected: usize, actual: usize },\n\n    /// Header CRC32 checksum mismatch.\n    #[error(\"header CRC32 mismatch: expected {expected:#010x}, actual {actual:#010x}\")]\n    HeaderCrc32Mismatch { expected: u32, actual: u32 },\n\n    /// Payload CRC32 checksum mismatch.\n    #[error(\"payload CRC32 mismatch: expected {expected:#010x}, computed {computed:#010x}\")]\n    Crc32Mismatch { expected: u32, computed: u32 },\n\n    /// Unknown record type without UPGRADE_SAFE flag — hard error.\n    #[error(\"unknown record id {record_id} without UPGRADE_SAFE flag\")]\n    UnknownNonUpgradeSafeRecord { record_id: u16 },\n\n    /// Invalid record length.\n    #[error(\"invalid record length: {length}\")]\n    InvalidRecordLength { length: u32 },\n\n    /// Record data exceeds remaining file.\n    #[error(\n        \"record data exceeds file bounds: offset {offset}, length {length}, file size {file_size}\"\n    )]\n    RecordExceedsFile {\n        offset: u64,\n        length: u32,\n        file_size: u64,\n    },\n\n    /// File header is internally inconsistent (e.g. a reserved field is\n    /// nonzero).\n    #[error(\"invalid header: {reason}\")]\n    InvalidHeader { reason: &'static str },\n\n    /// A `RestoreCatalog` record was encountered during sync apply with an","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/format/mod.rs#L177-L213","documentation":"A record read from the catalog log declared an implausible length field ({length}). The reader rejects lengths that cannot form a valid record (e.g. zero or beyond the framing limits), concluding the framing is broken rather than trusting the value. This almost always indicates byte-level corruption or a misaligned read offset.","triggerScenarios":"Reading a catalog log whose length prefix was overwritten/corrupted, or reading at a wrong offset (e.g. after skipping records incorrectly), or a truncated file where a partial length was read.","commonSituations":"Disk corruption, manual file surgery on catalog files, restoring a partially-copied snapshot, tooling that concatenated catalog segments incorrectly.","solutions":["Restore the catalog files from a verified backup or the object-store checkpoint.","Check that all catalog segment files were copied completely and unmodified (compare checksums of the copied files against source).","Stop any process concurrently writing to the catalog directory during backup/restore."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Sanity-check copied files before pointing InfluxDB at them\nfor f in catalog_files {\n    let copied = fs::metadata(dest.join(f))?.len();\n    let src = fs::metadata(src.join(f))?.len();\n    if copied != src { return Err(format!(\"{} size mismatch (partial copy?)\", f)); }\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = catalog.replay() {\n    if e.to_string().contains(\"invalid record length\") {\n        eprintln!(\"catalog framing corrupted; restore from checkpoint\");\n    }\n}","preventionTips":["Copy catalog files only while the database is stopped","Verify copied file sizes/checksums against the source","Never hand-edit or concatenate catalog segment files"],"tags":["corruption","framing","catalog","persistence"],"backgroundTag":"schema-validation-failed","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}