atuinsh/atuin · error

too many entries in v0 dotfiles var delete record

Error message

too many entries in v0 dotfiles var delete record

What it means

The v0 dotfiles var delete record must be a MsgPack array of exactly 1 entry (the variable name). The deserializer enforces nfields == 1 after the delete discriminator and rejects other counts. Extra entries signal malformed or schema-incompatible data.

Solutions

  1. Re-delete the var with the current CLI: `atuin dotfiles var delete <name>`.
  2. Correct the encoder to emit a single-entry array for delete.
  3. Upgrade all sync peers to matching Atuin versions.

Example fix

// before: encode::to_bytes(&(name, extra))
// after:  encode::to_bytes(&(name,))
Defensive patterns

Strategy: validation

Validate before calling

let value: rmpv::Value = rmpv::decode::read_value(&mut cursor)?;
// var delete variant: discriminator 1 requires exactly 1 field
assert_eq!(value.as_array().map(|a| a.len()), Some(1));

Type guard

fn is_well_formed_var_delete(payload: &[u8]) -> bool {
    rmpv::decode::read_value(&mut std::io::Cursor::new(payload))
        .ok()
        .and_then(|v| v.as_array().map(|a| a.len() == 1))
        .unwrap_or(false)
}

Try / catch

match ShellVar::deserialize(&bytes) {
    Ok(var) => handle(var),
    Err(e) if e.to_string().contains("too many entries") => {
        log::warn("dropping malformed var delete record: {e}");
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Deserializing a v0 var record with discriminator 1 (delete) whose array length is not 1 — e.g. a record written by an incompatible encoder or with corrupted bytes.

Common situations: Version skew between synced Atuin clients, manually written records, or corruption in the record store.

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@900007c480 (2026-09-19). Data as JSON: /api/errors/83827749a6fc8e9a. Report an issue: GitHub.

Appendix: source

Thrown at crates/atuin-dotfiles/src/store/var.rs:70

        }

        match version {
            RecordVersion::V0 => {
                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 env = Var::deserialize(&mut bytes)?;
                        Ok(Self::Create(env))
                    }

                    // delete
                    1 => {
                        let nfields = decode::read_array_len(&mut bytes).map_err(error_report)?;
                        ensure!(nfields == 1, "too many entries in v0 dotfiles var delete record");

                        let bytes = bytes.remaining_slice();

                        let (key, bytes) =
                            decode::read_str_from_slice(bytes).map_err(error_report)?;

                        if !bytes.is_empty() {
                            bail!("trailing bytes in encoded dotfiles var record. malformed");
                        }

                        Ok(Self::Delete(key.to_owned()))
                    }

                    n => {
                        bail!("unknown Dotfiles var record type {n}");
                    }
                }
            }

View on GitHub (pinned to 900007c480)