{"record":{"id":"35bc0fa0d95b50d2","repo":"atuinsh/atuin","slug":"daemon-rejected-shutdown-request","errorCode":null,"errorMessage":"Daemon rejected shutdown request","messagePattern":"Daemon rejected shutdown request","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin/src/command/client/daemon.rs","lineNumber":551,"sourceCode":"    let Ok(mut client) = connect_client(settings).await else {\n        println!(\"Daemon is not running\");\n        return Ok(());\n    };\n\n    match client.shutdown().await {\n        Ok(true) => {\n            println!(\"Shutdown requested\");\n\n            let pidfile_path = PathBuf::from(&settings.daemon.pidfile_path);\n            let timeout = Duration::from_secs(5);\n            match wait_for_pidfile_available(&pidfile_path, timeout).await {\n                Ok(()) => println!(\"Daemon stopped\"),\n                Err(_) => println!(\"Daemon may still be shutting down\"),\n            }\n\n            Ok(())\n        }\n        Ok(false) => bail!(\"Daemon rejected shutdown request\"),\n        Err(err) => Err(err.wrap_err(\"Failed to send shutdown request\")),\n    }\n}\n\nasync fn restart_cmd(settings: &Settings) -> Result<()> {\n    // Stop if running\n    match probe(settings).await {\n        Probe::Ready(_) | Probe::NeedsRestart(_) => {\n            request_shutdown(settings).await;\n            println!(\"Stopping daemon...\");\n\n            let pidfile_path = PathBuf::from(&settings.daemon.pidfile_path);\n            let timeout = Duration::from_secs(5);\n            wait_for_pidfile_available(&pidfile_path, timeout)\n                .await\n                .wrap_err(\"Timed out waiting for old daemon to stop\")?;\n        }\n        Probe::Unreachable(_) => {","sourceCodeStart":533,"sourceCodeEnd":569,"githubUrl":"https://github.com/atuinsh/atuin/blob/900007c48045867e7f44b0f9bc55ad9dbe99ee0d/crates/atuin/src/command/client/daemon.rs#L533-L569","documentation":"`stop_cmd` sent a shutdown request to the daemon, but the daemon replied indicating it did not accept/acknowledge the shutdown (the response's boolean was false). The CLI bails instead of printing \"Daemon stopped\".","triggerScenarios":"Running `atuin daemon stop` and the daemon's shutdown RPC responds `Ok(false)`, i.e. the daemon explicitly rejected the request.","commonSituations":"Daemon in a bad or busy state; protocol/version skew between client and daemon causing the request to be rejected; daemon mid-shutdown already.","solutions":["Retry `atuin daemon stop` after a moment.","Kill the daemon process directly (find PID via the socket/process list) and remove any stale socket file.","Check that client and daemon versions match; restart the daemon with the current binary."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match daemon_stop().await {\n    Ok(()) => println!(\"stopped\"),\n    Err(e) if e.to_string().contains(\"rejected shutdown\") => {\n        // fall back to killing the process / removing the socket\n        kill_daemon_process()?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep client and daemon versions in sync.","Retry stop before force-killing.","Verify the daemon is responsive (Status RPC) before issuing shutdown."],"tags":["daemon","shutdown","rpc"],"backgroundTag":"unexpected-api-response-shape","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"}