{"record":{"id":"7e794c4bd481c962","repo":"atuinsh/atuin","slug":"err-reason","errorCode":null,"errorMessage":"{err.reason}","messagePattern":"\\{err\\.reason\\}","errorType":"http","errorClass":"HubErrorResponse","httpStatus":403,"severity":"error","filePath":"crates/atuin-client/src/auth.rs","lineNumber":312,"sourceCode":"            .context(\"failed to connect to Atuin Hub\")?;\n\n        let status = resp.status();\n\n        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!({","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin-client/src/auth.rs#L294-L330","documentation":"Structured-error propagation in the auth-module login: the Hub returned HTTP 403 FORBIDDEN with a JSON HubErrorResponse whose code is not the special '2fa_required' case, so the server-provided reason string is raised verbatim as the error. The reason text is authored server-side and states exactly why login was refused (e.g. account disabled, registration restricted).","triggerScenarios":"Thrown at crates/atuin-client/src/auth.rs:312 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the surfaced reason text and address the specific server-stated cause","If the account is locked or restricted, contact the Hub host","Verify your 2FA setup if two-factor authentication is involved"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}