atuinsh/atuin · error

unknown error

Error message

unknown error

What it means

Generic catch-all in `change_password` for any HTTP status other than 200/401/403. The library has no specific mapping, so any other server response — client error, rate limit, or server failure — surfaces as this opaque bail. It hides the real status code from the caller.

Solutions

  1. Reproduce with curl against `<sync_address>/account/password` to see the real status and body
  2. Check the new password meets the server's requirements if the status is 400
  3. Confirm server version compatibility and upgrade self-hosted Atuin server if the route is missing
  4. Retry with backoff for 429/5xx responses after checking server health/logs

Example fix

// before
_ => bail!("unknown error"),
// after
_ => {
    let status = resp.status();
    let body = resp.text().await.unwrap_or_default();
    bail!("password change failed: {status} {body}");
}
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: confirm the password endpoint exists on this server
let probe = reqwest::Client::new()
    .patch(format!("{sync_address}/account/password"))
    .send().await?;
if probe.status() == reqwest::StatusCode::NOT_FOUND {
    bail!("server does not expose /account/password; upgrade server");
}

Try / catch

match auth_client.change_password(current, new, totp).await {
    Ok(MutateResponse::Success) => println!("ok"),
    Err(e) if e.to_string() == "unknown error" => {
        // status unmapped: inspect server, back off, retry
        tokio::time::sleep(Duration::from_secs(5)).await;
        // retry once, then surface diagnostics
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: The `PATCH account/password` endpoint returns 400 (validation rejected the new password), 404 (wrong/legacy server route), 409, 429 (rate limited), or any 5xx; also proxies returning HTML error pages.

Common situations: New password violating server-side policy (400); outdated self-hosted server lacking the endpoint (404); server outage or load balancer 502/503; rate limiting after multiple failed attempts.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of atuinsh/atuin@900007c480 (2026-09-19). Data as JSON: /api/errors/87e625ad0e4dd5f8. Report an issue: GitHub.

Appendix: source

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

        let resp = client
            .patch(url)
            .json(&ChangePasswordRequest {
                current_password: current_password.to_string(),
                new_password: new_password.to_string(),
            })
            .send()
            .await?;

        match resp.status().as_u16() {
            200 => Ok(MutateResponse::Success),
            401 => {
                bail!("current password is incorrect");
            }
            403 => {
                bail!("invalid login details");
            }
            _ => {
                bail!("unknown error");
            }
        }
    }

    async fn delete_account(
        &self,
        password: &str,
        _totp_code: Option<&str>,
    ) -> Result<MutateResponse> {
        let client = self.authenticated_client()?;
        let url = self.address.append(["account"])?;

        let resp =
            client.delete(url).json(&serde_json::json!({ "password": password })).send().await?;

        match resp.status().as_u16() {
            200 => Ok(MutateResponse::Success),
            401 => {

View on GitHub (pinned to 900007c480)