atuinsh/atuin · error

Daemon rejected shutdown request

Error message

Daemon rejected shutdown request

What it means

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.

Source

Thrown at crates/atuin/src/command/client/daemon.rs:552

    let Ok(mut client) = connect_client(settings).await else {
        println!("Daemon is not running");
        return Ok(());
    };

    match client.shutdown().await {
        Ok(true) => {
            println!("Shutdown requested");

            let pidfile_path = PathBuf::from(&settings.daemon.pidfile_path);
            let timeout = Duration::from_secs(5);
            match wait_for_pidfile_available(&pidfile_path, timeout).await {
                Ok(()) => println!("Daemon stopped"),
                Err(_) => println!("Daemon may still be shutting down"),
            }

            Ok(())
        }
        Ok(false) => bail!("Daemon rejected shutdown request"),
        Err(err) => Err(err.wrap_err("Failed to send shutdown request")),
    }
}

async fn restart_cmd(settings: &Settings) -> Result<()> {
    // Stop if running
    match probe(settings).await {
        Probe::Ready(_) | Probe::NeedsRestart(_) => {
            request_shutdown(settings).await;
            println!("Stopping daemon...");

            let pidfile_path = PathBuf::from(&settings.daemon.pidfile_path);
            let timeout = Duration::from_secs(5);
            wait_for_pidfile_available(&pidfile_path, timeout)
                .await
                .wrap_err("Timed out waiting for old daemon to stop")?;
        }
        Probe::Unreachable(_) => {

View on GitHub (pinned to c0c717ab04)

Solutions

  1. Retry `atuin daemon stop`; transient refusals often clear
  2. Kill the daemon process directly and restart it
  3. Check daemon logs for why the shutdown was rejected
Defensive patterns

Strategy: retry

Validate before calling

// verify daemon is responsive before stopping
// atuin daemon status  (or probe the daemon socket)
if !daemon_socket_reachable() { eprintln!("daemon not running; nothing to stop"); }

Try / catch

match stop_cmd(&settings).await {
    Err(e) if e.to_string().contains("rejected shutdown request") => {
        // retry once, then fall back to killing the process
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running `atuin daemon stop`; the shutdown request reaches the daemon, the daemon responds (Ok(false)) instead of acknowledging shutdown.

Common situations: Daemon busy or in a state where shutdown is refused; stale/partially wedged daemon process; permission or state mismatch between CLI and daemon.

Related errors


AI-assisted analysis of atuinsh/atuin@c0c717ab04 (2026-09-12). Data as JSON: /api/errors/35bc0fa0d95b50d2. Report an issue: GitHub.