atuinsh/atuin · error · HubErrorResponse

{err.reason}

Error message

{err.reason}

What it means

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).

Source

Thrown at crates/atuin-client/src/auth.rs:312

            .context("failed to connect to Atuin Hub")?;

        let status = resp.status();

        if status.is_success() {
            let login: LoginResponse = resp.json().await?;
            return Ok(AuthResponse::Success {
                session: login.session,
                auth_type: login.auth,
            });
        }

        if status == StatusCode::FORBIDDEN
            && let Ok(err) = resp.json::<HubErrorResponse>().await
        {
            if err.code.as_deref() == Some("2fa_required") {
                return Ok(AuthResponse::TwoFactorRequired);
            }
            bail!("{}", err.reason);
        }

        if status == StatusCode::UNAUTHORIZED {
            bail!("invalid credentials");
        }

        bail!("Hub login failed with status {status}");
    }

    async fn register(&self, username: &str, email: &str, password: &str) -> Result<AuthResponse> {
        let url = self.address.append_path("api/v0/register")?;
        let client = reqwest::Client::new();

        let resp = client
            .post(url)
            .header(USER_AGENT, APP_USER_AGENT)
            .header(ATUIN_HEADER_VERSION, ATUIN_CARGO_VERSION)
            .json(&serde_json::json!({

View on GitHub (pinned to c0c717ab04)

Solutions

  1. Read the surfaced reason text and address the specific server-stated cause
  2. If the account is locked or restricted, contact the Hub host
  3. Verify your 2FA setup if two-factor authentication is involved
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/atuin-client/src/auth.rs:312 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of atuinsh/atuin@c0c717ab04 (2026-09-12). Data as JSON: /api/errors/7e794c4bd481c962. Report an issue: GitHub.