atuinsh/atuin · error

Daemon rejected shutdown request

Error message

Daemon rejected shutdown request

What it means

`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".

Solutions

  1. Retry `atuin daemon stop` after a moment.
  2. Kill the daemon process directly (find PID via the socket/process list) and remove any stale socket file.
  3. Check that client and daemon versions match; restart the daemon with the current binary.
Defensive patterns

Strategy: try-catch

Try / catch

match daemon_stop().await {
    Ok(()) => println!("stopped"),
    Err(e) if e.to_string().contains("rejected shutdown") => {
        // fall back to killing the process / removing the socket
        kill_daemon_process()?;
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Running `atuin daemon stop` and the daemon's shutdown RPC responds `Ok(false)`, i.e. the daemon explicitly rejected the request.

Common situations: Daemon in a bad or busy state; protocol/version skew between client and daemon causing the request to be rejected; daemon mid-shutdown already.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


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

Appendix: source

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

    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 900007c480)