{"record":{"id":"989d88f371e764a9","repo":"atuinsh/atuin","slug":"trailing-bytes-in-encoded-dotfiles-var-record-mal","errorCode":null,"errorMessage":"trailing bytes in encoded dotfiles var record. malformed","messagePattern":"trailing bytes in encoded dotfiles var record\\. malformed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-dotfiles/src/store/var.rs","lineNumber":78,"sourceCode":"                match record_type {\n                    // create\n                    0 => {\n                        let env = Var::deserialize(&mut bytes)?;\n                        Ok(Self::Create(env))\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 dotfiles var 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 dotfiles var record. malformed\");\n                        }\n\n                        Ok(Self::Delete(key.to_owned()))\n                    }\n\n                    n => {\n                        bail!(\"unknown Dotfiles var record type {n}\");\n                    }\n                }\n            }\n            other => {\n                bail!(\"unknown var record version {other:?}\");\n            }\n        }\n    }\n}\n\n#[derive(Debug, Clone)]","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin-dotfiles/src/store/var.rs#L60-L96","documentation":"Decoder guard in VarRecord::deserialize: after reading a v0 dotfiles var record's expected fields, leftover bytes remain in the payload. A well-formed v0 record consumes its buffer exactly; trailing bytes mean the record is malformed — corruption, truncation of an earlier write, or an encoder/decoder mismatch.","triggerScenarios":"Thrown at crates/atuin-dotfiles/src/store/var.rs:78 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete and re-create the affected var record, or re-sync the dotfiles store","Check for disk corruption or interrupted sync writes","Report to Atuin if it recurs on a fresh sync"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c0c717ab04c881764bcad4b3d169a507e2432643","analyzedAt":"2026-09-12T07:40:01.341Z","contentChangedAt":"2026-09-12T07:40:01.341Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}