atuinsh/atuin · error

failed to parse server version: {:?}

Error message

failed to parse server version: {:?}

What it means

`ensure_version` reads the `x-atuin-version` header from a server response and parses it as a semver `Version`. If the header is present but is not valid UTF-8 (`to_str` fails), the error bails with the underlying `ToStrError` debug-formatted.

Source

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

    let client = reqwest::Client::new();

    let resp = client.get(url).header(USER_AGENT, APP_USER_AGENT).send().await?;
    let resp = handle_resp_error(resp).await?;

    let index = resp.json::<IndexResponse>().await?;
    let version = Version::parse(index.version.as_str())?;

    Ok(version)
}

pub fn ensure_version(response: &Response) -> Result<bool> {
    let version = response.headers().get(ATUIN_HEADER_VERSION);

    let version = if let Some(version) = version {
        match version.to_str() {
            Ok(v) => Version::parse(v),
            Err(e) => {
                bail!("failed to parse server version: {:?}", e);
            }
        }
    } else {
        bail!("Server not reporting its version: it is either too old or unhealthy");
    }?;

    // If the client is newer than the server
    if version.major < ATUIN_VERSION.major {
        println!(
            "Atuin version mismatch! In order to successfully sync, the server needs to run a \
             newer version of Atuin"
        );
        println!("Client: {ATUIN_CARGO_VERSION}");
        println!("Server: {version}");

        return Ok(false);
    }

View on GitHub (pinned to c0c717ab04)

Solutions

  1. Inspect the raw response header `x-atuin-version` (curl -i) and fix its value
  2. Check reverse proxy/middleware for header rewriting bugs
  3. Upgrade or restart the sync server so it emits a clean semver version
Defensive patterns

Strategy: try-catch

Validate before calling

// validate the header is clean UTF-8 semver before use
let raw = resp.headers().get("x-atuin-version")
    .and_then(|v| v.to_str().ok())
    .and_then(|v| Version::parse(v).ok());
if raw.is_none() {
    eprintln!("server returned an unparsable x-atuin-version");
}

Try / catch

match ensure_version(&resp) {
    Err(e) if e.to_string().contains("failed to parse server version") => {
        eprintln!("check your proxy/server for a malformed x-atuin-version header");
    }
    other => other?,
}

Prevention

When it happens

Trigger: A response from the sync server has a version header that is not valid header-value UTF-8 — typically caused by a middleware/proxy injecting a malformed header value

Common situations: Misconfigured reverse proxy or custom atuin-server fork emitting a corrupt `x-atuin-version` header during register/login/record_status

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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