atuinsh/atuin · error

too many entries in v0 shell alias create record

Error message

too many entries in v0 shell alias create record

What it means

The v0 shell alias create record must be a MsgPack array of exactly 2 entries (key and value). The deserializer reads the array length and rejects any other count, since the alias type discriminator already selected the 'create' variant. Extra entries indicate a malformed or incompatible payload.

Solutions

  1. Re-create the alias so it is encoded with the current schema: `atuin dotfiles alias set <name> <value>`.
  2. Fix the writing side to emit exactly two entries (key, value) for the create variant.
  3. Align Atuin versions across sync peers to avoid schema skew.

Example fix

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

Strategy: validation

Validate before calling

let value: rmpv::Value = rmpv::decode::read_value(&mut cursor)?;
// create variant: discriminator 0 requires exactly 2 fields
assert_eq!(value.as_array().map(|a| a.len()), Some(2));

Type guard

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

Try / catch

match ShellAlias::deserialize(&bytes) {
    Ok(alias) => apply(alias),
    Err(e) if e.to_string().contains("too many entries") => {
        log::warn("skipping malformed alias record: {e}");
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Deserializing a v0 shell alias record whose discriminator byte is 0 (create) but whose array length is not 2 — e.g. an encoder that added fields to the create payload or supplied a 1-element array.

Common situations: Syncing records between Atuin versions with differing alias schemas, manually crafted records, or corrupted payloads 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/0c126d98f9819d61. Report an issue: GitHub.

Appendix: source

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

    pub fn deserialize(data: &DecryptedData, version: &RecordVersion) -> Result<Self> {
        use rmp::decode;

        fn error_report<E: std::fmt::Debug>(err: E) -> eyre::Report {
            eyre!("{err:?}")
        }

        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 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(),
                        }))
                    }

View on GitHub (pinned to 900007c480)