{"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":"validation","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/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin-dotfiles/src/shell.rs#L32-L68","documentation":"The v0 dotfiles env 'create' record is a msgpack array that must contain exactly 3 fields (name, value, export flag). During record deserialization, the array length read from the encoded bytes did not equal 3, so the payload is rejected as malformed. This guards against corrupt or future-incompatible record data in the record store.","triggerScenarios":"Calling the dotfiles store deserialization on a v0 env create record whose msgpack payload decodes to an array length other than 3 (e.g. 2, 4+ fields).","commonSituations":"Hand-edited or corrupted sync data; records produced by a newer atuin version synced to an older client; data mangled by another tool writing to the record store SQLite DB.","solutions":["Check for multiple atuin versions in your sync setup and upgrade all clients to the same version","Re-push the affected dotfile env var with `atuin dotfiles` commands to overwrite the bad record","Inspect the record store DB for the corrupted record and delete it so it re-syncs","If data loss is broad, re-sync dotfiles from a known-good machine"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before importing/syncing, sanity-check the record payload decodes to a 3-element array\nlet n = rmp::decode::read_array_len(&bytes[..])?;\nif n != 3 { return Err(\"malformed v0 env create record\".into()); }","typeGuard":null,"tryCatchPattern":"match DotfileEnvRecord::deserialize(&data) {\n    Ok(rec) => apply(rec),\n    Err(e) => log::warn!(\"skipping malformed env record: {e}\"),\n}","preventionTips":["Keep all synced atuin clients on the same version","Never hand-edit record store databases","Re-create records from a current client instead of patching payloads","Validate record payloads when importing from untrusted sources"],"tags":["msgpack","deserialization","dotfiles","record-store","versioning"],"backgroundTag":"schema-validation-failed","analyzedSha":"c0c717ab04c881764bcad4b3d169a507e2432643","analyzedAt":"2026-09-12T07:40:01.341Z","contentChangedAt":"2026-09-12T07:40:01.341Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}