{"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":552,"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":534,"sourceCodeEnd":570,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin/src/command/client/daemon.rs#L534-L570","documentation":"The `atuin daemon stop` command sends a shutdown RPC and expects the daemon to acknowledge it. If the RPC completes but reports the daemon did not accept the shutdown, the command bails with this message. It indicates the daemon explicitly refused the stop request rather than the request failing to be delivered.","triggerScenarios":"Running `atuin daemon stop`; the shutdown request reaches the daemon, the daemon responds (Ok(false)) instead of acknowledging shutdown.","commonSituations":"Daemon busy or in a state where shutdown is refused; stale/partially wedged daemon process; permission or state mismatch between CLI and daemon.","solutions":["Retry `atuin daemon stop`; transient refusals often clear","Kill the daemon process directly and restart it","Check daemon logs for why the shutdown was rejected"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify daemon is responsive before stopping\n// atuin daemon status  (or probe the daemon socket)\nif !daemon_socket_reachable() { eprintln!(\"daemon not running; nothing to stop\"); }","typeGuard":null,"tryCatchPattern":"match stop_cmd(&settings).await {\n    Err(e) if e.to_string().contains(\"rejected shutdown request\") => {\n        // retry once, then fall back to killing the process\n    }\n    other => other?,\n}","preventionTips":["Retry stop before force-killing","Inspect daemon logs for refusal reasons","Keep the daemon healthy/idle during shutdown"],"tags":["daemon","shutdown","cli"],"backgroundTag":"operation-rejected","analyzedSha":"c0c717ab04c881764bcad4b3d169a507e2432643","analyzedAt":"2026-09-12T07:40:01.341Z","contentChangedAt":"2026-09-12T07:40:01.341Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}