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

RmRegisterResources failed: {err:?}

Error message

RmRegisterResources failed: {err:?}

What it means

After starting a Restart Manager session, the updater registers the Zed files it wants to modify via `RmRegisterResources`. If the API rejects the registration the update aborts with the returned HRESULT. Registration fails on invalid paths, a stale/invalidated session, or service-level errors.

Source

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

                .chain(std::iter::once(0))
                .collect()
        })
        .collect();

    if wide_paths.is_empty() {
        log::info!("No files to release handles for");
        return Ok(());
    }

    let pcwstr_paths: Vec<PCWSTR> = wide_paths
        .iter()
        .map(|p| PCWSTR::from_raw(p.as_ptr()))
        .collect();

    // Register the files we want to modify
    let err = unsafe { RmRegisterResources(session, Some(&pcwstr_paths), None, None) };
    if err.is_err() {
        anyhow::bail!("RmRegisterResources failed: {err:?}");
    }

    // Check if any processes are using these files
    let mut needed: u32 = 0;
    let mut count: u32 = 0;
    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
    );

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check the updater log's preceding lines: it logs 'No files to release handles for' or the file list — confirm the install path is a normal, stable path without odd characters.
  2. Reboot to reset RPC state and retry the update.
  3. Retry after disabling/changing antivirus configuration that hooks file registration.
  4. Fall back to the full installer to update without the Restart Manager path.
Defensive patterns

Strategy: try-catch

Validate before calling

// Sanity-check paths before handing them to the Restart Manager
let all_normal = files.iter().all(|p| p.is_absolute() && p.exists());
if !all_normal { /* skip RM registration for missing/odd paths */ }

Try / catch

match register_resources(session, &wide_paths) {
    Ok(()) => {}
    Err(err) => log::warn!("RmRegisterResources failed ({err:#}); skipping handle release"),
}

Prevention

When it happens

Trigger: `RmRegisterResources(session, &pcwstr_paths, ...)` fails: one of the wide-string paths is malformed (interior NUL, bad UTF-16 conversion), the session handle is no longer valid, or the RPC channel to the Restart Manager died between `RmStartSession` and this call.

Common situations: App directory paths with unusual characters that break UTF-16 conversion; RPC interruptions on busy or unstable machines; antivirus interfering with RM calls; moving the app while the updater runs.

Related errors


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