{"record":{"id":"586b576efa2de545","repo":"atuinsh/atuin","slug":"invalid-credentials","errorCode":null,"errorMessage":"invalid credentials","messagePattern":"invalid credentials","errorType":"exception","errorClass":null,"httpStatus":401,"severity":"error","filePath":"crates/atuin-client/src/auth.rs","lineNumber":316,"sourceCode":"        if status.is_success() {\n            let login: LoginResponse = resp.json().await?;\n            return Ok(AuthResponse::Success {\n                session: login.session,\n                auth_type: login.auth,\n            });\n        }\n\n        if status == StatusCode::FORBIDDEN\n            && let Ok(err) = resp.json::<HubErrorResponse>().await\n        {\n            if err.code.as_deref() == Some(\"2fa_required\") {\n                return Ok(AuthResponse::TwoFactorRequired);\n            }\n            bail!(\"{}\", err.reason);\n        }\n\n        if status == StatusCode::UNAUTHORIZED {\n            bail!(\"invalid credentials\");\n        }\n\n        bail!(\"Hub login failed with status {status}\");\n    }\n\n    async fn register(&self, username: &str, email: &str, password: &str) -> Result<AuthResponse> {\n        let url = self.address.append_path(\"api/v0/register\")?;\n        let client = reqwest::Client::new();\n\n        let resp = client\n            .post(url)\n            .header(USER_AGENT, APP_USER_AGENT)\n            .header(ATUIN_HEADER_VERSION, ATUIN_CARGO_VERSION)\n            .json(&serde_json::json!({\n                \"email\": email,\n                \"username\": username,\n                \"password\": password,\n            }))","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/atuinsh/atuin/blob/900007c48045867e7f44b0f9bc55ad9dbe99ee0d/crates/atuin-client/src/auth.rs#L298-L334","documentation":"In `HubAuthClient::login`, an HTTP 401 (UNAUTHORIZED) response is mapped to this fixed bail. 401 means the supplied username/password combination failed authentication on the Hub. The client deliberately does not parse the body and reports 'invalid credentials'.","triggerScenarios":"POST `api/v0/login` with a wrong username, wrong password, or a username that doesn't exist (server answers 401 for both to avoid user enumeration).","commonSituations":"Typo'd username or password in `atuin login`; credentials from a password manager out of date after a recent change; attempting login on Atuin Hub with a local-only/self-hosted account; case-sensitivity mistakes in username.","solutions":["Re-enter username and password carefully, checking for autocorrect/whitespace issues","Verify the account exists on Atuin Hub (register first if not) and that you're logging into the right service","Reset the password via the Hub web UI if it may have changed","If 2FA is enabled on the account, run login again and provide the TOTP code when prompted","Confirm you're not mixing credentials from a self-hosted server with the public Hub"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"// Basic client-side sanity checks before hitting the Hub\nif username.trim().is_empty() || password.is_empty() {\n    bail!(\"username and password must be non-empty\");\n}\n// Optionally verify credentials independently before login","typeGuard":"fn is_invalid_credentials(err: &Report) -> bool {\n    err.to_string() == \"invalid credentials\"\n}","tryCatchPattern":"match hub.login(username, password, totp).await {\n    Ok(AuthResponse::Success { .. }) => println!(\"logged in\"),\n    Err(e) if e.to_string() == \"invalid credentials\" => {\n        eprintln!(\"check username/password; reset via Hub web UI if forgotten\");\n    }\n    Ok(AuthResponse::TwoFactorRequired) => { /* collect TOTP and retry */ }\n    Err(e) => return Err(e),\n}","preventionTips":["Double-check username/password for typos, casing, and stray whitespace","Keep credentials current — re-login after any password change elsewhere","Confirm the account exists on the target service (Hub vs self-hosted)","Enable and supply 2FA codes to avoid ambiguous auth failures"],"tags":["http","authentication","atuin-hub","login","credentials"],"backgroundTag":"invalid-credentials","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"}