{"record":{"id":"241e465cd8591238","repo":"atuinsh/atuin","slug":"hub-registration-failed-with-status-status","errorCode":null,"errorMessage":"Hub registration failed with status {status}","messagePattern":"Hub registration failed with status (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-client/src/auth.rs","lineNumber":353,"sourceCode":"            .send()\n            .await\n            .context(\"failed to connect to Atuin Hub\")?;\n\n        let status = resp.status();\n\n        if status.is_success() {\n            let reg: RegisterResponse = resp.json().await?;\n            return Ok(AuthResponse::Success {\n                session: reg.session,\n                auth_type: reg.auth,\n            });\n        }\n\n        if let Ok(err) = resp.json::<HubErrorResponse>().await {\n            bail!(\"{}\", err.reason);\n        }\n\n        bail!(\"Hub registration failed with status {status}\");\n    }\n\n    async fn change_password(\n        &self,\n        current_password: &str,\n        new_password: &str,\n        totp_code: Option<&str>,\n    ) -> Result<MutateResponse> {\n        let hub_token = self.hub_token.as_deref().ok_or_else(|| {\n            eyre::eyre!(\"Not logged in to Atuin Hub. Please run 'atuin login' to authenticate.\")\n        })?;\n\n        if !hub_token.starts_with(\"atapi_\") {\n            bail!(\n                \"Your Hub session token is invalid. Please run 'atuin login' to re-authenticate \\\n                 with Atuin Hub.\"\n            );\n        }","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/atuinsh/atuin/blob/900007c48045867e7f44b0f9bc55ad9dbe99ee0d/crates/atuin-client/src/auth.rs#L335-L371","documentation":"Fallback error in `register` (crates/atuin-client/src/auth.rs:353): the Hub returned a non-success HTTP status, but the response body could NOT be parsed as a `HubErrorResponse` (empty body, HTML error page, or unexpected JSON shape). The status code is the only diagnostic available.","triggerScenarios":"POST to `/api/v0/register` fails with any non-2xx status and a body that fails `resp.json::<HubErrorResponse>()` — e.g. 500 from a proxy, 429 rate limit with an empty body, or a reverse proxy returning an HTML error page.","commonSituations":"Hub outage or maintenance; intermediate proxies/load balancers swallowing the JSON error body; running a client version against a Hub version with different error schema; aggressive registration rate limiting.","solutions":["Check the HTTP status in the message for the class of failure (4xx client vs 5xx server).","Check Atuin Hub status / retry later if 5xx.","Ensure client and server versions are compatible (`atuin --version`); update if old.","Inspect network path for proxies that could alter the response body."],"exampleFix":"// before\nbail!(\"Hub registration failed with status {status}\");\n// after: capture body text for diagnosis\nlet body = resp.text().await.unwrap_or_default();\nbail!(\"Hub registration failed with status {status}: {body}\");","handlingStrategy":"retry","validationCode":"// Verify connectivity and server reachability before registering\nlet probe = reqwest::get(format!(\"{hub_url}/api/v0/register\")).await;\nlet reachable = matches!(probe, Ok(r) if !r.status().is_server_error());","typeGuard":null,"tryCatchPattern":"match client.register(u, e, p).await {\n    Err(e) if e.to_string().contains(\"failed with status 5\") => {\n        // server-side / unparseable response: retry with backoff\n    }\n    Err(e) => eprintln!(\"registration failed: {e}\"),\n    Ok(_) => { /* success */ }\n}","preventionTips":["Monitor Atuin Hub status before account operations.","Avoid proxies that rewrite error response bodies.","Keep client and Hub versions aligned.","Back off and retry on 5xx/429 instead of hammering the endpoint."],"tags":["http","api","registration","network"],"backgroundTag":"unexpected-http-status","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"}