atuinsh/atuin · error

too many entries in v0 dotfiles env create record, got {}, e

Error message

too many entries in v0 dotfiles env create record, got {}, expected {}

What it means

The v0 dotfiles env 'create' record is a msgpack array that must contain exactly 3 fields (name, value, export flag). During record deserialization, the array length read from the encoded bytes did not equal 3, so the payload is rejected as malformed. This guards against corrupt or future-incompatible record data in the record store.

Source

Thrown at crates/atuin-dotfiles/src/shell.rs:50

    /// This is intended to be called by the store
    pub fn serialize(&self, output: &mut Vec<u8>) -> Result<()> {
        encode::write_array_len(output, 3)?; // 3 fields

        encode::write_str(output, self.name.as_str())?;
        encode::write_str(output, self.value.as_str())?;
        encode::write_bool(output, self.export)?;

        Ok(())
    }

    pub fn deserialize(bytes: &mut decode::Bytes) -> Result<Self> {
        fn error_report<E: std::fmt::Debug>(err: E) -> eyre::Report {
            eyre!("{err:?}")
        }

        let nfields = decode::read_array_len(bytes).map_err(error_report)?;

        ensure!(
            nfields == 3,
            "too many entries in v0 dotfiles env create record, got {}, expected {}",
            nfields,
            3
        );

        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)?;

        let mut bytes = decode::Bytes::new(bytes);
        let export = decode::read_bool(&mut bytes).map_err(error_report)?;

        ensure!(
            bytes.remaining_slice().is_empty(),
            "trailing bytes in encoded dotfiles env record, malformed"
        );

View on GitHub (pinned to c0c717ab04)

Solutions

  1. Check for multiple atuin versions in your sync setup and upgrade all clients to the same version
  2. Re-push the affected dotfile env var with `atuin dotfiles` commands to overwrite the bad record
  3. Inspect the record store DB for the corrupted record and delete it so it re-syncs
  4. If data loss is broad, re-sync dotfiles from a known-good machine
Defensive patterns

Strategy: validation

Validate before calling

// before importing/syncing, sanity-check the record payload decodes to a 3-element array
let n = rmp::decode::read_array_len(&bytes[..])?;
if n != 3 { return Err("malformed v0 env create record".into()); }

Try / catch

match DotfileEnvRecord::deserialize(&data) {
    Ok(rec) => apply(rec),
    Err(e) => log::warn!("skipping malformed env record: {e}"),
}

Prevention

When it happens

Trigger: Calling the dotfiles store deserialization on a v0 env create record whose msgpack payload decodes to an array length other than 3 (e.g. 2, 4+ fields).

Common situations: Hand-edited or corrupted sync data; records produced by a newer atuin version synced to an older client; data mangled by another tool writing to the record store SQLite DB.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of atuinsh/atuin@c0c717ab04 (2026-09-12). Data as JSON: /api/errors/6d68a1c8c1ce735b. Report an issue: GitHub.