{"record":{"id":"3469ef70cd60b859","repo":"zed-industries/zed","slug":"rmstartsession-failed-err","errorCode":null,"errorMessage":"RmStartSession failed: {err:?}","messagePattern":"RmStartSession failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/auto_update_helper/src/updater.rs","lineNumber":302,"sourceCode":"        app_dir.join(\"bin\\\\zed\"),\n        app_dir.join(\"conpty.dll\"),\n    ];\n\n    log::info!(\"Attempting to release file handles using Restart Manager...\");\n\n    let mut session: u32 = 0;\n    let mut session_key = [0u16; CCH_RM_SESSION_KEY as usize + 1];\n\n    // Start a Restart Manager session\n    let err = unsafe {\n        RmStartSession(\n            &mut session,\n            Some(0),\n            PWSTR::from_raw(session_key.as_mut_ptr()),\n        )\n    };\n    if err.is_err() {\n        anyhow::bail!(\"RmStartSession failed: {err:?}\");\n    }\n\n    // Ensure we end the session when done\n    let _session_guard = scopeguard::guard(session, |s| {\n        let _ = unsafe { RmEndSession(s) };\n    });\n\n    // Convert paths to wide strings for Windows API\n    let wide_paths: Vec<Vec<u16>> = files_to_release\n        .iter()\n        .filter(|p| p.exists())\n        .map(|p| {\n            OsStr::new(p)\n                .encode_wide()\n                .chain(std::iter::once(0))\n                .collect()\n        })\n        .collect();","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/auto_update_helper/src/updater.rs#L284-L320","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Handle-release is an optimization; failing it should not abort the whole update\nmatch release_file_handles(&files) {\n    Ok(()) => {}\n    Err(err) => log::warn!(\"restart manager unavailable ({err:#}); continuing without handle release\"),\n}\n// proceed with the update","preventionTips":["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."],"tags":["windows","restart-manager","hresult","auto-update","updater"],"backgroundTag":"windows-api-hresult-failure","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}