zed-industries/zed · error · anyhow::Error
RmStartSession failed: {err:?}
Error message
RmStartSession failed: {err:?} What it means
The Windows auto-updater uses the Restart Manager API to ask processes holding handles to Zed's files to release them. `RmStartSession` creates the RM session; if it returns an error HRESULT the whole handle-release step (and thus the update) is aborted with this message. This is a Win32/Restart Manager failure, not a Zed-logic failure.
Source
Thrown at crates/auto_update_helper/src/updater.rs:302
app_dir.join("bin\\zed"),
app_dir.join("conpty.dll"),
];
log::info!("Attempting to release file handles using Restart Manager...");
let mut session: u32 = 0;
let mut session_key = [0u16; CCH_RM_SESSION_KEY as usize + 1];
// Start a Restart Manager session
let err = unsafe {
RmStartSession(
&mut session,
Some(0),
PWSTR::from_raw(session_key.as_mut_ptr()),
)
};
if err.is_err() {
anyhow::bail!("RmStartSession failed: {err:?}");
}
// Ensure we end the session when done
let _session_guard = scopeguard::guard(session, |s| {
let _ = unsafe { RmEndSession(s) };
});
// Convert paths to wide strings for Windows API
let wide_paths: Vec<Vec<u16>> = files_to_release
.iter()
.filter(|p| p.exists())
.map(|p| {
OsStr::new(p)
.encode_wide()
.chain(std::iter::once(0))
.collect()
})
.collect();View on GitHub (pinned to f4178619ac)
Solutions
- Verify required services are running: `sc query RpcSs` and check Event Viewer for Restart Manager errors; reboot to reset service state.
- Run the updater with normal privileges and confirm the user can create sessions; try again after closing other applications.
- If it persists, download the full installer and update manually — it replaces files without the RM path.
- Report the HRESULT text from the log line to identify the specific Win32 error.
Defensive patterns
Strategy: try-catch
Try / catch
// Handle-release is an optimization; failing it should not abort the whole update
match release_file_handles(&files) {
Ok(()) => {}
Err(err) => log::warn!("restart manager unavailable ({err:#}); continuing without handle release"),
}
// proceed with the update Prevention
- Treat Restart Manager calls as best-effort: log and continue rather than aborting the update.
- Keep RpcSs and related services running; check Event Viewer after RM failures.
- Retry after reboot when RM sessions repeatedly fail to start.
When it happens
Trigger: `RmStartSession(&mut session, Some(0), ...)` returns a failing HRESULT: RPC service unavailable, Restart Manager cannot allocate a session key, system resource exhaustion, or a stripped-down Windows where the service is disabled.
Common situations: Broken RPC/Windows services on the machine, Group Policy or security software blocking Restart Manager, very locked-down Windows installs, memory pressure preventing session creation.
Related errors
- RmRegisterResources failed: {err:?}
- RmShutdown failed: {:?}
- Delete operations cannot be rolled back, file: {}
- Autoupdate failed, nothing to rollback
- Job rollback failed, the app might be left in an inconsisten
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/3469ef70cd60b859.
Report an issue: GitHub.