{"record":{"id":"4e3af01eaebf4a89","repo":"atuinsh/atuin","slug":"please-provide-the-current-password","errorCode":null,"errorMessage":"please provide the current password","messagePattern":"please provide the current password","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin/src/command/client/account/change_password.rs","lineNumber":34,"sourceCode":"    #[clap(long, short)]\n    pub totp_code: Option<String>,\n}\n\nimpl Cmd {\n    pub async fn run(&self, settings: &Settings) -> Result<()> {\n        if !settings.logged_in().await? {\n            bail!(\"You are not logged in\");\n        }\n\n        let client = auth::auth_client(settings).await;\n\n        let current_password = self.current_password.clone().unwrap_or_else(|| {\n            prompt_password(\"Please enter the current password: \")\n                .expect(\"Failed to read from input\")\n        });\n\n        if current_password.is_empty() {\n            bail!(\"please provide the current password\");\n        }\n\n        let new_password = self.new_password.clone().unwrap_or_else(|| {\n            prompt_password(\"Please enter the new password: \").expect(\"Failed to read from input\")\n        });\n\n        if new_password.is_empty() {\n            bail!(\"please provide a new password\");\n        }\n\n        let mut totp_code = self.totp_code.clone();\n\n        loop {\n            let response = client\n                .change_password(&current_password, &new_password, totp_code.as_deref())\n                .await?;\n\n            match response {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin/src/command/client/account/change_password.rs#L16-L52","documentation":"The change-password command requires a non-empty current password. If `--current-password` was not passed, it prompts interactively; after resolution, an empty string is rejected with this bail rather than sending a useless request to the server.","triggerScenarios":"Passing `--current-password ''` (empty value) to `atuin account change-password`, or piping empty stdin (e.g. `echo '' |` or `</dev/null` in scripts) so the interactive prompt resolves to an empty string.","commonSituations":"Scripting the command headlessly and forgetting the flag; an env-var expansion like `--current-password \"$PW\"` where PW is unset; CI runners with no TTY supplying empty input.","solutions":["Pass the current password explicitly: `atuin account change-password --current-password '<pw>'`","Ensure the env var feeding the flag is actually set before invoking","Run interactively in a terminal so the prompt can read a real password","Use a secrets manager to inject the value instead of an empty placeholder"],"exampleFix":"// before: PW unset, expands to empty\natuin account change-password --current-password \"$PW\"\n\n// after\natuin account change-password --current-password \"$CURRENT_PW\" --new-password \"$NEW_PW\"","handlingStrategy":"validation","validationCode":"[ -n \"$CURRENT_PW\" ] || { echo 'current password is empty' >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"if ! atuin account change-password --current-password \"$CURRENT_PW\" ...; then\n  echo \"Password rejected — check it is non-empty and correct\" >&2\nfi","preventionTips":["Always pass --current-password explicitly in scripts","Assert secrets are non-empty before invoking atuin","Use `set -u` in shell scripts to catch unset variables","Run interactive prompts only from a real TTY"],"tags":["cli","validation","password"],"backgroundTag":"empty-required-field","analyzedSha":"c0c717ab04c881764bcad4b3d169a507e2432643","analyzedAt":"2026-09-12T07:40:01.341Z","contentChangedAt":"2026-09-12T07:40:01.341Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}