{"record":{"id":"62426a3305d20fe1","repo":"atuinsh/atuin","slug":"no-encryption-key-provided","errorCode":null,"errorMessage":"No encryption key provided","messagePattern":"No encryption key provided","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin/src/command/client/account/login.rs","lineNumber":210,"sourceCode":"        println!(\"IMPORTANT\");\n        println!(\n            \"If you are already logged in on another machine, you must ensure that the key you \\\n             use here is the same as the key you used there.\"\n        );\n        println!(\"You can find your key by running 'atuin key' on the other machine.\");\n        println!(\"Do not share this key with anyone.\");\n        println!(\"\\nRead more here: {} \\n\", atuin_common::docs::url(\"guide/sync/#login\"));\n\n        let interactive = self.interactive();\n        let mut flag_key = self.key.clone();\n\n        loop {\n            let key = match flag_key.take() {\n                Some(key) => key,\n                None => match read_user_input(\"encryption key [blank to use existing key file]\") {\n                    Some(key) => key,\n                    // Stdin is exhausted, so re-prompting would spin forever.\n                    None => bail!(\"No encryption key provided\"),\n                },\n            };\n\n            if key.is_empty() {\n                if !key_path.exists() {\n                    let msg = \"No key provided and no existing key file found. Please use 'atuin \\\n                               key' on your other machine, or recover your key from a backup\";\n                    if !interactive {\n                        bail!(msg);\n                    }\n                    println!(\"\\n{msg}\\n\");\n                    continue;\n                }\n\n                paseto_v4::Key::try_load_from_path(key_path).context(format!(\n                    \"The key in existing key file at '{}' is invalid\",\n                    key_path.to_string_lossy()\n                ))?;","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/atuinsh/atuin/blob/900007c48045867e7f44b0f9bc55ad9dbe99ee0d/crates/atuin/src/command/client/account/login.rs#L192-L228","documentation":"During login, `prompt_and_store_key` must obtain the encryption key: either from the `--key` flag or interactively. If stdin is exhausted (EOF) the read returns None and re-prompting would loop forever, so it bails with 'No encryption key provided'.","triggerScenarios":"Running `atuin login` non-interactively (no TTY, stdin closed or redirected from /dev/null) without `--key`; automation scripts that never supply the key.","commonSituations":"CI/containers running `atuin login` with piped credentials but no key; scripts that redirect stdin; tmux/ssh sessions with detached stdin.","solutions":["Pass the key explicitly: `atuin login --key <your key>`","Pipe the key into stdin: `echo \"$ATUIN_KEY\" | atuin login ...` so the read succeeds","Run login once in an interactive terminal to store the key, then automate the rest"],"exampleFix":"// before\necho \"$PW\" | atuin login -u me   # stdin EOFs before key prompt\n// after\necho \"$ATUIN_KEY\" | atuin login -u me --key \"$ATUIN_KEY\"\n# or simply: atuin login -u me --key \"$ATUIN_KEY\"","handlingStrategy":"validation","validationCode":"[ -n \"$ATUIN_KEY\" ] || { echo 'ATUIN_KEY required for non-interactive login'; exit 1; }\natuin login -u \"$USER\" --key \"$ATUIN_KEY\"","typeGuard":null,"tryCatchPattern":"atuin login --key \"$ATUIN_KEY\" || { echo 'login failed; check key'; exit 1; }","preventionTips":["Always pass --key in CI/non-interactive contexts","Store the key in a secret manager and inject it at deploy time","Avoid redirecting stdin from /dev/null for interactive-dependent commands"],"tags":["cli","encryption","key","non-interactive"],"backgroundTag":"missing-required-argument","analyzedSha":"900007c48045867e7f44b0f9bc55ad9dbe99ee0d","analyzedAt":"2026-09-19T12:52:51.491Z","contentChangedAt":"2026-09-19T12:52:51.491Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}