{"record":{"id":"f23ebc67afbae467","repo":"atuinsh/atuin","slug":"too-many-entries-in-v0-shell-alias-delete-record","errorCode":null,"errorMessage":"too many entries in v0 shell alias delete record","messagePattern":"too many entries in v0 shell alias delete record","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-dotfiles/src/store.rs","lineNumber":92,"sourceCode":"                        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\n                    // delete\n                    1 => {\n                        let nfields = decode::read_array_len(&mut bytes).map_err(error_report)?;\n                        ensure!(nfields == 1, \"too many entries in v0 shell alias delete 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\n                        if !bytes.is_empty() {\n                            bail!(\"trailing bytes in encoded shell alias record. malformed\");\n                        }\n\n                        Ok(Self::Delete(key.to_owned()))\n                    }\n\n                    n => {\n                        bail!(\"unknown AliasRecord type {n}\");\n                    }\n                }\n            }","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/atuinsh/atuin/blob/900007c48045867e7f44b0f9bc55ad9dbe99ee0d/crates/atuin-dotfiles/src/store.rs#L74-L110","documentation":"The v0 shell alias delete record must be a MsgPack array of exactly 1 entry (the key). When the discriminator byte is 1 (delete), the deserializer enforces nfields == 1 and rejects anything else. This guards against malformed or newer-schema payloads.","triggerScenarios":"Deserializing a v0 alias delete record whose array length is not 1 — e.g. an encoder that wrote key plus extra fields, or a payload where the delete variant was mis-encoded.","commonSituations":"Records produced by a newer Atuin version synced to an older client, hand-written record encoders, or corrupted sync data.","solutions":["Re-issue the delete operation through the current CLI rather than replaying the old record.","Fix the encoder to write exactly one entry (key) for delete records.","Sync-check all peers' Atuin versions and upgrade."],"exampleFix":"// before: encode::to_bytes(&(key, extra))\n// after:  encode::to_bytes(&(key,))","handlingStrategy":"validation","validationCode":"let value: rmpv::Value = rmpv::decode::read_value(&mut cursor)?;\n// delete variant: discriminator 1 requires exactly 1 field\nassert_eq!(value.as_array().map(|a| a.len()), Some(1));","typeGuard":"fn is_well_formed_alias_delete(payload: &[u8]) -> bool {\n    rmpv::decode::read_value(&mut std::io::Cursor::new(payload))\n        .ok()\n        .and_then(|v| v.as_array().map(|a| a.len() == 1))\n        .unwrap_or(false)\n}","tryCatchPattern":"match ShellAlias::deserialize(&bytes) {\n    Ok(alias) => handle(alias),\n    Err(e) if e.to_string().contains(\"too many entries\") => {\n        log::warn(\"dropping malformed alias delete record\");\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Write delete records as single-element arrays only","Keep the record schema version tag in sync with the actual field count","Verify payloads with a MsgPack inspector when debugging sync issues"],"tags":["serialization","msgpack","aliases"],"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"}