{"record":{"id":"7ca5623f93013a1d","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"process-failed-to-start","errorCode":null,"errorMessage":"Process failed to start.","messagePattern":"Process failed to start\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"source/UninstallerAutomatizer/Automation/AutomatedUninstallManager.cs","lineNumber":108,"sourceCode":"                HideAutomatizedWindowsChanged?.Invoke(null, EventArgs.Empty);\n            }\n        }\n\n        /// <summary>\n        ///     Automate uninstallation of an NSIS uninstaller.\n        /// </summary>\n        /// <param name=\"uninstallerCommand\">Command line used to launch the NSIS uninstaller. (Usually path to uninstall.exe.)</param>\n        /// <param name=\"statusCallback\">Information about the process is relayed here</param>\n        public static void UninstallNsisQuietly(string uninstallerCommand, Action<string> statusCallback)\n        {\n            Process pr = null;\n            Application app = null;\n            try\n            {\n\n                pr = ProcessTools.SeparateArgsFromCommand(uninstallerCommand).ToProcessStartInfo().Start();\n                if (pr == null)\n                    throw new IOException(Localization.Message_Automation_ProcessFailedToStart);\n\n                // NSIS uninstallers are first extracted by the executable to a temporary directory, and then ran from there.\n                // Wait for the extracting exe to close and grab the child process that it started.\n                statusCallback(Localization.Message_Automation_WaitingForNsisExtraction);\n                pr.WaitForExit();\n\n                // Attempt to get the extracted exe by looking up child processes, might not work in some cases\n                var prs = ProcessTools.GetChildProcesses(pr.Id).FirstOrDefault();\n\n                if (prs != 0)\n                {\n                    app = Application.Attach(prs);\n                }\n                else\n                {\n                    // Get all processes with name in format [A-Z]u_ (standard NSIS naming scheme, e.g. \"Au_.exe\") \n                    // and select the last one to launch. (Most likely to be ours)\n                    var uninstallProcess = Process.GetProcesses()","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/UninstallerAutomatizer/Automation/AutomatedUninstallManager.cs#L90-L126","documentation":"Thrown as IOException when ProcessTools.SeparateArgsFromCommand(uninstallerCommand).ToProcessStartInfo().Start() returns null, meaning the NSIS uninstaller process could not be launched or attached. The library treats a null Start() result as a hard failure because without a live process handle the entire extraction/attach flow cannot proceed. It is the first guard in UninstallNsisQuietly, fired before any UI automation begins.","triggerScenarios":"Calling UninstallNsisQuietly with a command string whose executable path does not exist, is not an .exe, lacks execute permission, or cannot be spawned under the current user/UAC context. Also when SeparateArgsFromCommand mis-parses the command so ToProcessStartInfo produces an invalid ProcessStartInfo that Start() rejects. Any case where the Start() extension returns null rather than a Process object.","commonSituations":"Uninstaller command points to a path that was already removed (uninstall.exe deleted mid-batch). Quoting/argument splitting in uninstallerCommand breaks the filename from its args. Running the automation from a service/SYSTEM account without an interactive desktop, so the GUI uninstaller cannot be spawned. Antivirus or SRP/AppLocker blocking the launch of the extracted uninstaller.","solutions":["Verify the uninstaller path exists and is an executable before calling: File.Exists on the parsed command's filename.","Inspect how ProcessTools.SeparateArgsFromCommand splits the command and ensure the executable and arguments are separated correctly (quote paths containing spaces).","Run the parent process from an elevated, interactive desktop session so the uninstaller can be spawned and later attached via UI automation.","Check that no security software (AV, AppLocker, SRP) is silently blocking process creation; test launching the command manually first."],"exampleFix":"// before\npr = ProcessTools.SeparateArgsFromCommand(uninstallerCommand).ToProcessStartInfo().Start();\nif (pr == null)\n    throw new IOException(Localization.Message_Automation_ProcessFailedToStart);\n\n// after - validate the parsed executable before launching\nvar parsed = ProcessTools.SeparateArgsFromCommand(uninstallerCommand);\nif (!File.Exists(parsed.FileName))\n    throw new IOException($\"Uninstaller not found: {parsed.FileName}\");\npr = parsed.ToProcessStartInfo().Start();\nif (pr == null)\n    throw new IOException(Localization.Message_Automation_ProcessFailedToStart);","handlingStrategy":"validation","validationCode":"var parsed = ProcessTools.SeparateArgsFromCommand(uninstallerCommand);\nif (string.IsNullOrWhiteSpace(parsed.FileName) || !File.Exists(parsed.FileName))\n    throw new FileNotFoundException(\"Uninstaller executable not found\", parsed.FileName);","typeGuard":"// Ensure the command resolves to a real executable before calling UninstallNsisQuietly.\nbool CanLaunch(string command)\n{\n    var p = ProcessTools.SeparateArgsFromCommand(command);\n    return !string.IsNullOrWhiteSpace(p.FileName) && File.Exists(p.FileName);\n}","tryCatchPattern":"try { UninstallNsisQuietly(cmd, cb); }\ncatch (IOException io) when (io.Message == Localization.Message_Automation_ProcessFailedToStart)\n{\n    // log cmd, prompt user for correct uninstaller path\n}","preventionTips":["Validate the uninstaller path with File.Exists before launching.","Quote any path containing spaces in the command string so SeparateArgsFromCommand parses the filename correctly.","Run from an elevated interactive session so the GUI uninstaller can spawn and attach."],"tags":["nsis","process-launch","io","automation","uninstaller"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}