atuinsh/atuin · error

No encryption key provided

Error message

No encryption key provided

What it means

During login, atuin needs the account's encryption key. If no key was supplied via `--key` and the interactive read from stdin returns None (stdin exhausted, e.g. non-interactive runs), prompt_and_store_key bails immediately — re-prompting would loop forever.

Source

Thrown at crates/atuin/src/command/client/account/login.rs:210

        println!("IMPORTANT");
        println!(
            "If you are already logged in on another machine, you must ensure that the key you \
             use here is the same as the key you used there."
        );
        println!("You can find your key by running 'atuin key' on the other machine.");
        println!("Do not share this key with anyone.");
        println!("\nRead more here: {} \n", atuin_common::docs::url("guide/sync/#login"));

        let interactive = self.interactive();
        let mut flag_key = self.key.clone();

        loop {
            let key = match flag_key.take() {
                Some(key) => key,
                None => match read_user_input("encryption key [blank to use existing key file]") {
                    Some(key) => key,
                    // Stdin is exhausted, so re-prompting would spin forever.
                    None => bail!("No encryption key provided"),
                },
            };

            if key.is_empty() {
                if !key_path.exists() {
                    let msg = "No key provided and no existing key file found. Please use 'atuin \
                               key' on your other machine, or recover your key from a backup";
                    if !interactive {
                        bail!(msg);
                    }
                    println!("\n{msg}\n");
                    continue;
                }

                paseto_v4::Key::try_load_from_path(key_path).context(format!(
                    "The key in existing key file at '{}' is invalid",
                    key_path.to_string_lossy()
                ))?;

View on GitHub (pinned to c0c717ab04)

Solutions

  1. Pass the key explicitly: `atuin login --key <your-key>` (or via env/flag in your automation)
  2. Run `atuin login` in a real interactive terminal so the prompt can read input
  3. If an existing key file should be reused, pass an empty line interactively or ensure key_path exists
  4. Retrieve the key from the original machine with `atuin key` and supply it here

Example fix

// before: stdin exhausted -> bail
atuin login < /dev/null

// after
atuin login --key "<your-encryption-key>"
Defensive patterns

Strategy: validation

Validate before calling

[ -n "$ATUIN_KEY" ] || { echo 'encryption key required for non-interactive login' >&2; exit 1; }
atuin login --key "$ATUIN_KEY"

Try / catch

if ! atuin login --key "$ATUIN_KEY"; then
  echo "Login failed — key was missing or rejected" >&2
fi

Prevention

When it happens

Trigger: Running `atuin login` without `--key` in a non-interactive context: `atuin login < /dev/null`, CI scripts, or piping credentials so stdin is exhausted before the key prompt reads.

Common situations: Automated login in CI/Docker where prompts cannot be answered; piping output from another command that consumes stdin; forgetting the --key flag while scripting; running under a wrapper that closes stdin.

Related errors


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