{"record":{"id":"6d68a1c8c1ce735b","repo":"atuinsh/atuin","slug":"too-many-entries-in-v0-dotfiles-env-create-record","errorCode":null,"errorMessage":"too many entries in v0 dotfiles env create record, got {}, expected {}","messagePattern":"too many entries in v0 dotfiles env create record, got (.+?), expected (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-dotfiles/src/shell.rs","lineNumber":50,"sourceCode":"    /// This is intended to be called by the store\n    pub fn serialize(&self, output: &mut Vec<u8>) -> Result<()> {\n        encode::write_array_len(output, 3)?; // 3 fields\n\n        encode::write_str(output, self.name.as_str())?;\n        encode::write_str(output, self.value.as_str())?;\n        encode::write_bool(output, self.export)?;\n\n        Ok(())\n    }\n\n    pub fn deserialize(bytes: &mut decode::Bytes) -> Result<Self> {\n        fn error_report<E: std::fmt::Debug>(err: E) -> eyre::Report {\n            eyre!(\"{err:?}\")\n        }\n\n        let nfields = decode::read_array_len(bytes).map_err(error_report)?;\n\n        ensure!(\n            nfields == 3,\n            \"too many entries in v0 dotfiles env create record, got {}, expected {}\",\n            nfields,\n            3\n        );\n\n        let bytes = bytes.remaining_slice();\n\n        let (key, bytes) = decode::read_str_from_slice(bytes).map_err(error_report)?;\n        let (value, bytes) = decode::read_str_from_slice(bytes).map_err(error_report)?;\n\n        let mut bytes = decode::Bytes::new(bytes);\n        let export = decode::read_bool(&mut bytes).map_err(error_report)?;\n\n        ensure!(\n            bytes.remaining_slice().is_empty(),\n            \"trailing bytes in encoded dotfiles env record, malformed\"\n        );","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/atuinsh/atuin/blob/900007c48045867e7f44b0f9bc55ad9dbe99ee0d/crates/atuin-dotfiles/src/shell.rs#L32-L68","documentation":"The v0 dotfiles env 'create' record has a fixed MessagePack schema of exactly 3 fields. During deserialization the decoder reads the rmp array length and bails if it is not 3, rejecting malformed or from-the-future records rather than misparsing them.","triggerScenarios":"Decoding a v0 env var create record whose MessagePack payload encodes an array with more (or fewer) than 3 elements - typically a corrupt, hand-edited, or newer-version record in the store.","commonSituations":"Record store corrupted by manual edits, a record written by a different atuin version with a changed v0 layout, or bad data produced by a bug.","solutions":["Identify the bad record in the store and remove it (e.g. via record store tooling/sync from a healthy host)","Ensure all machines run a compatible atuin version, then re-sync the dotfiles records","Recreate the env var record with `atuin dotfiles env set` after clearing the bad record"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if let Ok(n) = rmp::decode::read_array_len(&bytes) {\n    if n != 3 {\n        eprintln!(\"unexpected v0 env record field count: {n}\");\n        return Ok(());\n    }\n}\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit the record store SQLite files","Keep atuin versions aligned across synced machines","Rebuild the store from trusted records after suspected corruption"],"tags":["dotfiles","record-store","deserialization"],"backgroundTag":"schema-validation-failed","analyzedSha":"900007c48045867e7f44b0f9bc55ad9dbe99ee0d","analyzedAt":"2026-09-19T12:52:51.491Z","contentChangedAt":"2026-09-19T12:52:51.491Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}