{"record":{"id":"8e100d196b45ffc8","repo":"rustdesk/rustdesk","slug":"msi-product-code-was-not-found-in-subkey","errorCode":null,"errorMessage":"MSI product code was not found in {subkey}","messagePattern":"MSI product code was not found in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/platform/windows.rs","lineNumber":1830,"sourceCode":"///\n/// # Parameters\n/// - `kill_self`: The command will kill the process of current app name. If `true`, it will kill\n///   the current process as well. If `false`, it will exclude the current process from the kill\n///   command.\n/// - `uninstall_printer`: If `true`, includes commands to uninstall the remote printer.\n///\n/// # Details\n/// The `uninstall_printer` parameter determines whether the command to uninstall the remote printer\n/// is included in the generated uninstall script. If `uninstall_printer` is `false`, the printer\n/// related command is omitted from the script.\nfn get_uninstall(kill_self: bool, uninstall_printer: bool) -> ResultType<String> {\n    let (subkey, path, start_menu, _) = get_install_info();\n    let installer_state = get_windows_installer_state(&subkey)?;\n    if let Some(product_code) = get_msi_product_code(&subkey, installer_state)? {\n        return Ok(build_msi_uninstall_command(&product_code));\n    }\n    if installer_state == Some(true) {\n        bail!(\"MSI product code was not found in {subkey}\");\n    }\n\n    let mut uninstall_cert_cmd = \"\".to_string();\n    let mut uninstall_printer_cmd = \"\".to_string();\n    if let Ok(exe) = std::env::current_exe() {\n        if let Some(exe_path) = exe.to_str() {\n            uninstall_cert_cmd = format!(\"\\\"{}\\\" --uninstall-cert\", exe_path);\n            if uninstall_printer {\n                uninstall_printer_cmd = format!(\"\\\"{}\\\" --uninstall-remote-printer\", &exe_path);\n            }\n        }\n    }\n    Ok(format!(\n        \"\n    {before_uninstall}\n    {uninstall_printer_cmd}\n    {uninstall_cert_cmd}\n    reg delete {subkey} /f","sourceCodeStart":1812,"sourceCodeEnd":1848,"githubUrl":"https://github.com/rustdesk/rustdesk/blob/91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540/src/platform/windows.rs#L1812-L1848","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect `Uninstall` registry keys under HKLM/HKCU for the RustDesk subkey and restore/locate the `ProductCode` value","Reinstall the same MSI version so the product code entry is recreated, then uninstall normally","If the entry is corrupt, export-and-delete the stale subkey so the non-MSI (EXE) uninstall fallback path runs","Use the MSI original package with `msiexec /x <original.msi>` if the GUID cannot be recovered"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn msi_uninstall_ready(subkey: &str) -> bool {\n    windows_registry_key_exists(subkey)\n        && registry_value_exists(subkey, \"ProductCode\")\n}","typeGuard":null,"tryCatchPattern":"match get_msi_product_code(&subkey, state) {\n    Ok(Some(pc)) => build_msi_uninstall_command(&pc),\n    Ok(None) if state == Some(true) => { /* surface this error with subkey in UI */ }\n    _ => fallback_exe_uninstall(),\n}","preventionTips":["Never hand-edit Uninstall registry keys","Complete MSI installs/uninstalls fully; avoid force-killing msiexec","Keep the installed MSI cached (%windir%\\Installer) for repair"],"tags":["windows","msi","registry","uninstaller"],"backgroundTag":"resource-not-found","analyzedSha":"91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540","analyzedAt":"2026-09-10T19:53:44.083Z","contentChangedAt":"2026-09-10T19:53:44.083Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}