{"record":{"id":"a4df718e3eec4849","repo":"atuinsh/atuin","slug":"trailing-bytes-in-encoded-history-malformed","errorCode":null,"errorMessage":"trailing bytes in encoded history. malformed","messagePattern":"trailing bytes in encoded history\\. malformed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-client/src/history.rs","lineNumber":334,"sourceCode":"\n        let intent = if match version {\n            Version::Zero => false,\n            Version::One => nfields > min_fields,\n            Version::Two => true,\n        } {\n            decode::read_optional(&mut bytes, decode::read_string)?\n        } else {\n            None\n        };\n\n        let shell = if version >= Version::Two {\n            decode::read_optional(&mut bytes, decode::read_string)?\n        } else {\n            None\n        };\n\n        if version < Version::Two && !bytes.remaining_slice().is_empty() {\n            bail!(\"trailing bytes in encoded history. malformed\");\n        }\n\n        Ok(History {\n            id: id.into(),\n            timestamp: OffsetDateTime::from_unix_nanos_u64(timestamp),\n            duration,\n            exit,\n            command,\n            cwd,\n            session,\n            author: author.unwrap_or_else(|| Self::author_from_hostname(&hostname)),\n            hostname,\n            intent,\n            deleted_at: deleted_at.map(OffsetDateTime::from_unix_nanos_u64),\n            shell,\n        })\n    }\n","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/atuinsh/atuin/blob/15fe1318f1df51de604262eb50734c9883d48e7b/crates/atuin-client/src/history.rs#L316-L352","documentation":"Error \"trailing bytes in encoded history. malformed\" thrown in atuinsh/atuin.","triggerScenarios":"Fires when extra undecoded bytes remain after parsing an encoded history record, indicating corruption.","commonSituations":"See trigger scenarios.","solutions":["The encoded history entry is corrupt; delete or rebuild the affected record and re-sync."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"15fe1318f1df51de604262eb50734c9883d48e7b","analyzedAt":"2026-08-19T08:56:57.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}