{"record":{"id":"598817b97083a146","repo":"atuinsh/atuin","slug":"trailing-bytes-in-encoded-shell-alias-record-malf","errorCode":null,"errorMessage":"trailing bytes in encoded shell alias record. malformed","messagePattern":"trailing bytes in encoded shell alias record\\. malformed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-dotfiles/src/store.rs","lineNumber":80,"sourceCode":"                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\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","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/atuinsh/atuin/blob/900007c48045867e7f44b0f9bc55ad9dbe99ee0d/crates/atuin-dotfiles/src/store.rs#L62-L98","documentation":"The alias record deserializer in atuin-dotfiles/src/store.rs decodes a Create alias record as two length-prefixed strings (key, value). If bytes remain in the buffer after reading both strings, the payload framing is invalid, so it bails with \"trailing bytes in encoded shell alias record. malformed\" — a corruption/protocol guard on the binary record format.","triggerScenarios":"Deserializing a shell-alias record (type Create) whose encoded payload carries extra bytes after name+value — caused by a record written by a different record-format version or a corrupted/truncated record received during sync.","commonSituations":"Record store data produced by an incompatible atuin version; partial writes or corruption in the local records DB; malicious/malformed records from a compromised sync peer.","solutions":["Locate and delete the malformed alias record from the record store so a clean copy can re-sync","Upgrade atuin on all devices to matching versions to remove format skew","Back up and check the records database for corruption","As a last resort, reset the dotfiles/record store and re-sync"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match alias_decode_result {\n    Err(e) if e.to_string().contains(\"trailing bytes in encoded shell alias record\") => {\n        // drop/quarantine the malformed record and re-sync\n    }\n    other => other?,\n}","preventionTips":["Keep atuin versions consistent across sync devices","Do not hand-edit the records database","Back up record store data before manual maintenance"],"tags":["serialization","sync","record-store"],"backgroundTag":"protobuf-unmarshal-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"}