rustdesk/rustdesk · error

MSI product code was not found in {subkey}

Error message

MSI product code was not found in {subkey}

What it means

Thrown by the MSI uninstall path when the registry says RustDesk was installed by an MSI (`installer_state == Some(true)`) but no product code could be read from the uninstall registry subkey (`get_msi_product_code` returned None). Without the product GUID, `msiexec /x` cannot be built, so uninstall is refused rather than attempted blindly.

Source

Thrown at src/platform/windows.rs:1830

///
/// # Parameters
/// - `kill_self`: The command will kill the process of current app name. If `true`, it will kill
///   the current process as well. If `false`, it will exclude the current process from the kill
///   command.
/// - `uninstall_printer`: If `true`, includes commands to uninstall the remote printer.
///
/// # Details
/// The `uninstall_printer` parameter determines whether the command to uninstall the remote printer
/// is included in the generated uninstall script. If `uninstall_printer` is `false`, the printer
/// related command is omitted from the script.
fn get_uninstall(kill_self: bool, uninstall_printer: bool) -> ResultType<String> {
    let (subkey, path, start_menu, _) = get_install_info();
    let installer_state = get_windows_installer_state(&subkey)?;
    if let Some(product_code) = get_msi_product_code(&subkey, installer_state)? {
        return Ok(build_msi_uninstall_command(&product_code));
    }
    if installer_state == Some(true) {
        bail!("MSI product code was not found in {subkey}");
    }

    let mut uninstall_cert_cmd = "".to_string();
    let mut uninstall_printer_cmd = "".to_string();
    if let Ok(exe) = std::env::current_exe() {
        if let Some(exe_path) = exe.to_str() {
            uninstall_cert_cmd = format!("\"{}\" --uninstall-cert", exe_path);
            if uninstall_printer {
                uninstall_printer_cmd = format!("\"{}\" --uninstall-remote-printer", &exe_path);
            }
        }
    }
    Ok(format!(
        "
    {before_uninstall}
    {uninstall_printer_cmd}
    {uninstall_cert_cmd}
    reg delete {subkey} /f

View on GitHub (pinned to 91c9fccbb0)

Solutions

  1. Inspect `Uninstall` registry keys under HKLM/HKCU for the RustDesk subkey and restore/locate the `ProductCode` value
  2. Reinstall the same MSI version so the product code entry is recreated, then uninstall normally
  3. If the entry is corrupt, export-and-delete the stale subkey so the non-MSI (EXE) uninstall fallback path runs
  4. Use the MSI original package with `msiexec /x <original.msi>` if the GUID cannot be recovered
Defensive patterns

Strategy: validation

Validate before calling

fn msi_uninstall_ready(subkey: &str) -> bool {
    windows_registry_key_exists(subkey)
        && registry_value_exists(subkey, "ProductCode")
}

Try / catch

match get_msi_product_code(&subkey, state) {
    Ok(Some(pc)) => build_msi_uninstall_command(&pc),
    Ok(None) if state == Some(true) => { /* surface this error with subkey in UI */ }
    _ => fallback_exe_uninstall(),
}

Prevention

When it happens

Trigger: Calling the uninstall function (src/platform/windows.rs:1830) on a machine where the `HKCU/HKLM ...\Uninstall\<subkey>` registry entry exists and is flagged MSI, but the `ProductCode` value is missing, renamed, or the entry was partially cleaned by another uninstaller.

Common situations: Interrupted MSI installs/uninstalls, third-party cleanup tools that stripped registry values, manual registry edits, or a version upgrade that changed where the product code is stored.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10). Data as JSON: /api/errors/8e100d196b45ffc8. Report an issue: GitHub.