{"record":{"id":"eaca4794094cbcaf","repo":"atuinsh/atuin","slug":"could-not-login-due-to-version-mismatch","errorCode":null,"errorMessage":"Could not login due to version mismatch","messagePattern":"Could not login due to version mismatch","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-client/src/api_client.rs","lineNumber":177,"sourceCode":"}\n\n#[instrument(level = \"trace\", skip_all, err)]\npub async fn login(\n    address: &Url,\n    req: LoginRequest,\n    extra_headers: &HashMap<String, String>,\n) -> Result<LoginResponse> {\n    let url = address.append([\"login\"])?;\n    let client = client_builder(extra_headers).build()?;\n\n    let mut headers = extra_headers_map(extra_headers)?;\n    headers.insert(USER_AGENT, APP_USER_AGENT.parse()?);\n\n    let resp = client.post(url).headers(headers).json(&req).send().await?;\n    let resp = handle_resp_error(resp).await?;\n\n    if !ensure_version(&resp)? {\n        bail!(\"Could not login due to version mismatch\");\n    }\n\n    let session = resp.json::<LoginResponse>().await?;\n    Ok(session)\n}\n\n#[cfg(feature = \"check-update\")]\n#[instrument(level = \"trace\", skip_all, err)]\npub async fn latest_version() -> Result<Version> {\n    use atuin_domain::api::IndexResponse;\n\n    let url = crate::settings::DEFAULT_SYNC_URL.clone();\n    let client = reqwest::Client::new();\n\n    let resp = client.get(url).header(USER_AGENT, APP_USER_AGENT).send().await?;\n    let resp = handle_resp_error(resp).await?;\n\n    let index = resp.json::<IndexResponse>().await?;","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/atuinsh/atuin/blob/900007c48045867e7f44b0f9bc55ad9dbe99ee0d/crates/atuin-client/src/api_client.rs#L159-L195","documentation":"After a login POST, `ensure_version` verifies the server version from the response headers. Login is aborted when the server is too old (or too new) for the client to interoperate with, preventing a partially working session.","triggerScenarios":"Running `atuin login` against a sync server whose version header fails the client's compatibility check.","commonSituations":"Self-hosted Atuin server lagging behind a recently updated client; enterprise deployments pinned to old releases.","solutions":["Upgrade the sync server to at least the client's major/minor version","Or downgrade the client to match the server","Verify the server reports a version header at all (curl the login endpoint)","Keep client and server updated together"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let server_ver = fetch_server_version(&address).await?;\nif semver::Version::parse(&server_ver)?.major < ATUIN_VERSION.major {\n    eprintln!(\"server too old for this client; upgrade server first\");\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"match login(&client, &address, req).await {\n    Err(e) if e.to_string().contains(\"version mismatch\") => {\n        // guide user to upgrade server or downgrade client\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Upgrade server before upgrading clients","Test login after any server upgrade","Avoid mixing nightly clients with stable servers"],"tags":["versioning","login","compatibility"],"backgroundTag":"api-error-response","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"}