{"record":{"id":"5cb3708f7311cb2a","repo":"atuinsh/atuin","slug":"message","errorCode":null,"errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin/src/command/client/daemon.rs","lineNumber":426,"sourceCode":"    let _ = wait_until_ready(settings, timeout).await?;\n\n    drop(startup_lock);\n    Ok(())\n}\n\nasync fn restart_daemon(settings: &Settings) -> Result<HistoryClient> {\n    ensure_daemon_running(settings).await?;\n    connect_client(settings).await\n}\n\nfn ensure_reply_compatible(settings: &Settings, version: &str, protocol: u32) -> Result<()> {\n    if daemon_matches_expected(version, protocol) {\n        return Ok(());\n    }\n\n    let message = daemon_mismatch_message(version, protocol);\n    if settings.daemon.autostart {\n        bail!(\"{message}\");\n    }\n\n    bail!(\"{message}. Enable `daemon.autostart = true` or restart the daemon manually\");\n}\n\n/// Acquire a [`HistoryClient`] connected to a daemon we expect to understand us, probing over the\n/// wire-stable Status RPC first and restarting the daemon if it is absent or version/protocol\n/// skewed.\n///\n/// TODO(markovejnovic): This is egregious slop, but not worse than the original solution. I want to\n///                      remove this in a future PR: <https://github.com/atuinsh/atuin/pull/4002>\npub async fn ready_client(settings: &Settings) -> Result<HistoryClient> {\n    match probe(settings).await {\n        Probe::Ready(client) => return Ok(client),\n        Probe::NeedsRestart(reason) if !settings.daemon.autostart => {\n            bail!(\"{reason}. Enable `daemon.autostart = true` or restart the daemon manually\");\n        }\n        Probe::Unreachable(err) if is_legacy_daemon_error(&err) => {","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin/src/command/client/daemon.rs#L408-L444","documentation":"Before using a running daemon, the CLI probes its version and protocol; ensure_reply_compatible checks that the daemon's reported version/protocol matches what this CLI expects. On mismatch it builds a human-readable message (via daemon_mismatch_message) and bails — appending advice to enable autostart (which would restart a matching daemon) when autostart is disabled.","triggerScenarios":"Upgrading or downgrading the atuin binary while an old (or new) daemon is still running, so the CLI's expected daemon protocol/version differs from the running daemon's reply during try_with_restart.","commonSituations":"`cargo install atuin` / package upgrade without restarting the background daemon; switching between distro package and cargo-installed binary with different daemon protocols; rolling back a release and hitting an older daemon.","solutions":["Restart the daemon: kill it (`pkill -f 'atuin daemon'`) and start the new one (`atuin daemon start`).","Enable `daemon.autostart = true` in config.toml so the CLI automatically replaces an incompatible daemon.","Make sure only one atuin binary/version is on PATH (`which -a atuin`) and remove stale copies.","If managed by systemd, restart the unit (`systemctl restart atuin-daemon`) after upgrading the binary."],"exampleFix":"// before\n$ atuin search ...   # after upgrading atuin\n// error: <mismatch message>. Enable daemon.autostart = true or restart the daemon manually\n// after\npkill -f 'atuin daemon' && atuin daemon start","handlingStrategy":"retry","validationCode":"# compare running daemon with CLI before heavy use\natuin status || { pkill -f 'atuin daemon'; atuin daemon start; }","typeGuard":null,"tryCatchPattern":"match client_op().await {\n    Err(e) if e.to_string().contains(\"daemon\") && e.to_string().contains(\"mismatch\") => {\n        restart_daemon()?; // pkill + start\n        client_op().await\n    }\n    other => other,\n}","preventionTips":["Restart the daemon as part of your atuin upgrade procedure.","Set daemon.autostart = true so the CLI replaces incompatible daemons automatically.","Keep a single atuin binary on PATH; remove duplicates from ~/.cargo/bin vs /usr/bin.","Restart the systemd daemon unit after package upgrades."],"tags":["daemon","version-mismatch","protocol","upgrade"],"backgroundTag":"incompatible-source-type","analyzedSha":"c0c717ab04c881764bcad4b3d169a507e2432643","analyzedAt":"2026-09-12T07:40:01.341Z","contentChangedAt":"2026-09-12T07:40:01.341Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}