atuinsh/atuin · error
trailing bytes in encoded shell alias record. malformed
Error message
trailing bytes in encoded shell alias record. malformed
What it means
While decoding an Alias record tagged Create (tag 0), extra bytes remained after reading the key/value string pair. Alias::Create payloads must contain exactly two strings, so leftovers indicate a malformed record.
Source
Thrown at crates/atuin-dotfiles/src/store.rs:80
let mut bytes = decode::Bytes::new(&data.0);
let record_type = decode::read_u8(&mut bytes).map_err(error_report)?;
match record_type {
// create
0 => {
let nfields = decode::read_array_len(&mut bytes).map_err(error_report)?;
ensure!(nfields == 2, "too many entries in v0 shell alias create record");
let bytes = bytes.remaining_slice();
let (key, bytes) =
decode::read_str_from_slice(bytes).map_err(error_report)?;
let (value, bytes) =
decode::read_str_from_slice(bytes).map_err(error_report)?;
if !bytes.is_empty() {
bail!("trailing bytes in encoded shell alias record. malformed");
}
Ok(Self::Create(Alias {
name: key.to_owned(),
value: value.to_owned(),
}))
}
// delete
1 => {
let nfields = decode::read_array_len(&mut bytes).map_err(error_report)?;
ensure!(nfields == 1, "too many entries in v0 shell alias delete record");
let bytes = bytes.remaining_slice();
let (key, bytes) =
decode::read_str_from_slice(bytes).map_err(error_report)?;
View on GitHub (pinned to c0c717ab04)
Solutions
- Re-sync the dotfiles record store (delete local record DB and re-download from the Hub)
- Upgrade atuin on all synced machines to the same version
- Restore the record store from a known-good backup
Defensive patterns
Strategy: try-catch
Type guard
fn is_wellformed_alias_create(payload: &[u8]) -> bool {
let (key, rest) = match decode::read_str_from_slice(payload) { Ok(v) => v, Err(_) => return false };
let (_, rest) = match decode::read_str_from_slice(rest) { Ok(v) => v, Err(_) => return false };
rest.is_empty()
} Try / catch
match Alias::deserialize(bytes) {
Ok(a) => apply(a),
Err(e) if e.to_string().contains("trailing bytes") => {
log::warn!("corrupt alias record skipped: {e}");
}
Err(e) => return Err(e),
} Prevention
- Keep atuin versions aligned across synced devices
- Avoid killing atuin mid-sync to prevent partial record writes
When it happens
Trigger: Deserializing an alias record with trailing bytes — corrupted record store blob, or a record written by an incompatible dotfiles record format version.
Common situations: Damaged local record database; syncing alias records from mismatched atuin versions.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- trailing bytes decoding HistoryRecord::Delete - malformed? g
- unknown HistoryRecord type {n}
- too many entries in v0 dotfiles env create record, got {}, e
- trailing bytes in encoded dotfiles env record, malformed
- too many entries in v0 dotfiles var delete record
AI-assisted analysis of atuinsh/atuin@c0c717ab04 (2026-09-12).
Data as JSON: /api/errors/598817b97083a146.
Report an issue: GitHub.