{"record":{"id":"f12dd1aed130f1e6","repo":"atuinsh/atuin","slug":"message-enable-daemon-autostart-true-or-res","errorCode":null,"errorMessage":"{message}. Enable `daemon.autostart = true` or restart the daemon manually","messagePattern":"(.+?)\\. Enable `daemon\\.autostart = true` or restart the daemon manually","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin/src/command/client/daemon.rs","lineNumber":429,"sourceCode":"    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) => {\n            return Err(err.wrap_err(LEGACY_DAEMON_RESTART_MESSAGE));\n        }\n        Probe::Unreachable(err) if !settings.daemon.autostart => return Err(err),","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin/src/command/client/daemon.rs#L411-L447","documentation":"When the running daemon's version or wire protocol does not match what the CLI expects, ensure_reply_compatible builds a mismatch message and bails. If daemon autostart is disabled, the CLI cannot restart the daemon itself, so it appends advice to either enable autostart or restart manually. This protects the client from talking to a daemon it cannot interoperate with.","triggerScenarios":"The CLI connects to a daemon whose reported version or protocol differs from the CLI's own, and settings.daemon.autostart is false, so try_with_restart cannot recover by restarting the daemon.","commonSituations":"Upgrading the atuin binary while an old daemon process is still running; daemons started from a different install (distro package vs cargo install); autostart explicitly disabled in config.","solutions":["Restart the atuin daemon manually (atuin daemon stop && atuin daemon start) so it matches the CLI version","Set daemon.autostart = true in ~/.config/atuin/config.toml so the CLI can restart a mismatched daemon automatically","Kill the stale daemon process and rerun the command"],"exampleFix":"// before (config.toml)\n[daemon]\nautostart = false\n// after\n[daemon]\nautostart = true","handlingStrategy":"try-catch","validationCode":"// check config before running daemon-backed commands\nlet cfg: toml::Value = toml::from_str(&std::fs::read_to_string(\"~/.config/atuin/config.toml\")?)?;\nlet autostart = cfg.get(\"daemon\").and_then(|d| d.get(\"autostart\")).and_then(|v| v.as_bool()).unwrap_or(false);\nif !autostart { eprintln!(\"daemon.autostart is disabled; restart the daemon manually after upgrades\"); }","typeGuard":null,"tryCatchPattern":"match cmd.await {\n    Err(e) if e.to_string().contains(\"Enable `daemon.autostart = true`\") => {\n        // restart daemon manually, then retry once\n    }\n    other => other?,\n}","preventionTips":["Keep daemon.autostart = true so version skew self-heals","Restart the daemon after every atuin upgrade","Use one installation method for the CLI and daemon"],"tags":["daemon","version-mismatch","protocol","configuration"],"backgroundTag":"version-incompatible","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"}