zed-industries/zed · error · anyhow::Error

RmShutdown failed: {:?}

Error message

RmShutdown failed: {:?}

What it means

`RmShutdown` asks the processes registered with the Restart Manager to gracefully release handles to Zed's files (typically Explorer's icon cache handles). If the API call itself returns an error HRESULT, the updater bails and the update stops. Note the failure is of the API call, not of apps refusing to shut down — refusal is reported through `RmGetList`, not here.

Source

Thrown at crates/auto_update_helper/src/updater.rs:359

    let mut reboot_reasons: u32 = 0;
    let _ = unsafe { RmGetList(session, &mut needed, &mut count, None, &mut reboot_reasons) };

    if needed == 0 {
        log::info!("No processes are holding handles to the files");
        return Ok(());
    }

    log::info!(
        "{} process(es) are holding handles to the files, requesting release...",
        needed
    );

    // Request processes to release their handles
    // RmShutdown with flags=0 asks applications to release handles gracefully
    // For Explorer, this typically releases icon cache handles without closing Explorer
    let err = unsafe { RmShutdown(session, 0, None) };
    if err.is_err() {
        anyhow::bail!("RmShutdown failed: {:?}", err);
    }

    log::info!("Successfully requested handle release");
    Ok(())
}

#[allow(clippy::disallowed_methods, reason = "doesn't run in the main binary")]
fn zed_launch_command(app_dir: &Path, launch_arguments: &[OsString]) -> std::process::Command {
    let mut command = std::process::Command::new(app_dir.join("Zed.exe"));
    command.args(launch_arguments);
    command
}

pub(crate) fn perform_update(
    app_dir: &Path,
    hwnd: Option<isize>,
    launch: bool,
    launch_arguments: &[OsString],

View on GitHub (pinned to f4178619ac)

Solutions

  1. Retry the update — transient handle states on Explorer commonly clear on the next attempt or after reboot.
  2. Close other applications before updating to reduce the set of processes in the RM session.
  3. Reboot and let the auto-updater run again from a clean state.
  4. If it repeats, update manually via the full downloaded installer.
Defensive patterns

Strategy: retry

Try / catch

match shutdown_handles(session) {
    Err(err) if is_transient(&err) => { sleep_backoff(); shutdown_handles(session) }
    result => result,
}

Prevention

When it happens

Trigger: `RmShutdown(session, 0, None)` returns a failing HRESULT: session invalidated (e.g., an earlier error), RPC failure to the service, or the service terminating the session because a registered process exited unexpectedly.

Common situations: Explorer or other registered processes crash/restart mid-shutdown; RPC instability; security software terminating RM sessions; repeated update attempts reusing a dead session.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/25353d6cb23cc205. Report an issue: GitHub.