atuinsh/atuin · error

username already in use

Error message

username already in use

What it means

Before registering, `register` probes `GET /user/{username}`. If that check succeeds (the username exists), registration would fail server-side, so the client bails early with 'username already in use'. Note this is triggered by a 2xx on the probe, not by reading a specific status code.

Source

Thrown at crates/atuin-client/src/api_client.rs:146

    password: &str,
    extra_headers: &HashMap<String, String>,
) -> Result<RegisterResponse> {
    let mut map = HashMap::new();
    map.insert("username", username);
    map.insert("email", email);
    map.insert("password", password);

    let mut headers = extra_headers_map(extra_headers)?;
    headers.insert(USER_AGENT, APP_USER_AGENT.parse()?);
    headers.insert(ATUIN_HEADER_VERSION, ATUIN_CARGO_VERSION.parse()?);

    let client = client_builder(extra_headers).build()?;

    let url = address.append(["user", username])?;
    let resp = client.get(url).headers(headers.clone()).send().await?;

    if resp.status().is_success() {
        bail!("username already in use");
    }

    let url = address.append(["register"])?;
    let resp = client.post(url).headers(headers).json(&map).send().await?;
    let resp = handle_resp_error(resp).await?;

    if !ensure_version(&resp)? {
        bail!("could not register user due to version mismatch");
    }

    let session = resp.json::<RegisterResponse>().await?;
    Ok(session)
}

#[instrument(level = "trace", skip_all, err)]
pub async fn login(
    address: &Url,
    req: LoginRequest,

View on GitHub (pinned to c0c717ab04)

Solutions

  1. Choose a different username
  2. If the existing account is yours, use `atuin login` instead of register
  3. Delete the old account via the hub if you no longer want the name

Example fix

// before
atuin register -u alice -e a@b.c -p '...'
// after
atuin register -u alice-2 -e a@b.c -p '...'  # or: atuin login -u alice
Defensive patterns

Strategy: validation

Validate before calling

// probe the username before registering
let probe = client.get(format!("{address}/user/{username}")).send().await?;
if probe.status().is_success() {
    eprintln!("username taken; choose another or use 'atuin login'");
    return Ok(());
}

Try / catch

match register(&client, address, username, email, password).await {
    Err(e) if e.to_string().contains("username already in use") => {
        prompt_alternate_username()
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling `atuin register` (or the `register` API function) with a username that already exists on the sync server, so `GET /user/{username}` returns success

Common situations: Re-running registration after a partial signup, trying a common username on a public sync server, or registering against a server where your old account still exists

Related errors


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