{"record":{"id":"01bafbef9070363f","repo":"atuinsh/atuin","slug":"please-provide-a-new-password","errorCode":null,"errorMessage":"please provide a new password","messagePattern":"please provide a new password","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin/src/command/client/account/change_password.rs","lineNumber":42,"sourceCode":"        }\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 {\n                MutateResponse::Success => break,\n                MutateResponse::TwoFactorRequired => {\n                    totp_code = Some(super::login::or_user_input(None, \"two-factor code\"));\n                }\n            }\n        }\n\n        println!(\"Account password successfully changed!\");","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin/src/command/client/account/change_password.rs#L24-L60","documentation":"The change-password command requires a non-empty new password. If `--new-password` is absent it prompts; an empty result is rejected with this bail before any server call, since the server cannot set an empty password.","triggerScenarios":"Passing `--new-password ''` to `atuin account change-password`, or the interactive prompt returning an empty line because stdin is empty/closed in a non-interactive run.","commonSituations":"Headless CI runs with `/dev/null` stdin; unset shell variables in the flag; forgetting the `--new-password` flag while automating; password-manager CLI returning empty output.","solutions":["Pass a non-empty value: `atuin account change-password --new-password '<new-pw>'`","Check the variable/expansion feeding the flag is populated","Run in an interactive terminal so the password prompt works","Generate and store the new password via a secrets tool before invoking the command"],"exampleFix":"// before: NEWPW empty -> bails\natuin account change-password --current-password \"$CUR\" --new-password \"$NEWPW\"\n\n// after: guard first\n[ -n \"$NEWPW\" ] && atuin account change-password --current-password \"$CUR\" --new-password \"$NEWPW\"","handlingStrategy":"validation","validationCode":"[ -n \"$NEW_PW\" ] || { echo 'new password is empty' >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"if ! atuin account change-password --new-password \"$NEW_PW\" ...; then\n  echo \"Password change failed — verify the new password is non-empty\" >&2\nfi","preventionTips":["Pass --new-password explicitly when automating","Generate the new password via a secrets manager before the call","Validate variables with [ -n ... ] before use","Avoid /dev/null stdin for commands that may prompt"],"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"}