{"record":{"id":"0c126d98f9819d61","repo":"atuinsh/atuin","slug":"too-many-entries-in-v0-shell-alias-create-record","errorCode":null,"errorMessage":"too many entries in v0 shell alias create record","messagePattern":"too many entries in v0 shell alias create record","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-dotfiles/src/store.rs","lineNumber":70,"sourceCode":"\n    pub fn deserialize(data: &DecryptedData, version: &RecordVersion) -> Result<Self> {\n        use rmp::decode;\n\n        fn error_report<E: std::fmt::Debug>(err: E) -> eyre::Report {\n            eyre!(\"{err:?}\")\n        }\n\n        match version {\n            RecordVersion::V0 => {\n                let mut bytes = decode::Bytes::new(&data.0);\n\n                let record_type = decode::read_u8(&mut bytes).map_err(error_report)?;\n\n                match record_type {\n                    // create\n                    0 => {\n                        let nfields = decode::read_array_len(&mut bytes).map_err(error_report)?;\n                        ensure!(nfields == 2, \"too many entries in v0 shell alias create record\");\n\n                        let bytes = bytes.remaining_slice();\n\n                        let (key, bytes) =\n                            decode::read_str_from_slice(bytes).map_err(error_report)?;\n                        let (value, bytes) =\n                            decode::read_str_from_slice(bytes).map_err(error_report)?;\n\n                        if !bytes.is_empty() {\n                            bail!(\"trailing bytes in encoded shell alias record. malformed\");\n                        }\n\n                        Ok(Self::Create(Alias {\n                            name: key.to_owned(),\n                            value: value.to_owned(),\n                        }))\n                    }\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin-dotfiles/src/store.rs#L52-L88","documentation":"A v0 shell alias 'create' record must be a msgpack array with exactly 2 fields (key and value). The deserializer reads the array length and rejects the record if it is not 2, indicating the payload does not match the v0 alias-create schema. This prevents misinterpreting corrupt or version-mismatched data as a valid alias.","triggerScenarios":"Deserializing a v0 alias create record (record_type 0) whose decoded msgpack array length differs from 2.","commonSituations":"Version-skew between synced clients (newer format vs older reader); corrupted record store data; records produced by third-party tools writing to the store.","solutions":["Upgrade atuin on all machines sharing the record store to the same version","Delete the malformed alias record and re-create it via `atuin dotfiles`","Re-sync aliases from a known-good machine","Inspect the record store DB directly if the corruption persists"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let n = rmp::decode::read_array_len(&mut bytes)?;\nif n != 2 { return Err(\"malformed v0 alias create record\".into()); }","typeGuard":null,"tryCatchPattern":"match AliasRecord::deserialize(&data) {\n    Ok(rec) => apply(rec),\n    Err(e) => log::warn!(\"skipping bad alias record: {e}\"),\n}","preventionTips":["Keep atuin versions uniform across synced machines","Don't write records with non-atuin tooling","Delete and re-create bad records rather than editing them","Back up the record store before manual DB work"],"tags":["msgpack","deserialization","alias","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"}