{"record":{"id":"37690645dd7a999d","repo":"microsoft/aspire","slug":"failed-to-invoke-createprocessw-while-starting-tracked","errorCode":null,"errorMessage":"Failed to invoke CreateProcessW while starting tracked browser CDP pipe.","messagePattern":"Failed to invoke CreateProcessW while starting tracked browser CDP pipe\\.","errorType":"exception","errorClass":"Win32Exception","httpStatus":null,"severity":"critical","filePath":"src/Aspire.Hosting.Browsers/BrowserLogsPipeBrowserProcessLauncher.Windows.cs","lineNumber":131,"sourceCode":"                },\n                lpAttributeList = attributeList\n            };\n            startupInfoPointer = Marshal.AllocHGlobal(Marshal.SizeOf<STARTUPINFOEX>());\n            Marshal.StructureToPtr(startupInfo, startupInfoPointer, fDeleteOld: false);\n\n            if (!CreateProcessW(\n                lpApplicationName: IntPtr.Zero,\n                lpCommandLine: commandLine,\n                lpProcessAttributes: IntPtr.Zero,\n                lpThreadAttributes: IntPtr.Zero,\n                bInheritHandles: true,\n                dwCreationFlags: EXTENDED_STARTUPINFO_PRESENT | CREATE_NO_WINDOW,\n                lpEnvironment: IntPtr.Zero,\n                lpCurrentDirectory: IntPtr.Zero,\n                lpStartupInfo: startupInfoPointer,\n                lpProcessInformation: out var processInformation))\n            {\n                throw CreateWindowsException(\"CreateProcessW\");\n            }\n\n            return new WindowsProcessInfo(processInformation.dwProcessId, processInformation.hProcess, processInformation.hThread);\n        }\n        finally\n        {\n            DeleteProcThreadAttributeList(attributeList);\n            Marshal.FreeHGlobal(startupInfoPointer);\n            Marshal.FreeHGlobal(attributeList);\n            Marshal.FreeHGlobal(handleList);\n            Marshal.FreeHGlobal(commandLine);\n        }\n    }\n\n    internal static string BuildWindowsCommandLine(string executablePath, IReadOnlyList<string> arguments)\n    {\n        var builder = new StringBuilder();\n        AppendWindowsCommandLineArgument(builder, executablePath);","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Browsers/BrowserLogsPipeBrowserProcessLauncher.Windows.cs#L113-L149","documentation":"Aspire's tracked browser launcher on Windows calls the Win32 CreateProcessW API to spawn the browser process with a CDP pipe attached. When the OS call fails (returns FALSE), the launcher throws a Win32Exception-wrapped error naming 'CreateProcessW' so the underlying Win32 error code is preserved. This indicates the browser executable could not be started at all.","triggerScenarios":"CreateWindowsProcess calls CreateProcessW with EXTENDED_STARTUPINFO_PRESENT|CREATE_NO_WINDOW and it returns FALSE - typically because the browser executable path is invalid, the file is missing, the command line is malformed, or the caller lacks execute permission.","commonSituations":"Browser channel/install not present on the machine (Edge/Chrome missing or partially uninstalled); a misconfigured custom browser path; antivirus blocking process creation; restricted service account without rights to spawn processes.","solutions":["Verify the browser executable the launcher targets actually exists at the resolved path and launches manually.","Check the inner Win32Exception NativeErrorCode for the exact OS reason (2=file not found, 5=access denied, 87=invalid parameter).","Reinstall or repair the browser installation the launcher resolves.","Run under an account/environment with permission to create child processes; check antivirus/EDR blocking.","Update the Aspire.Hosting.Browsers package - launcher path-resolution may have fixes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var browserPath = ResolveBrowserPath(); // path the launcher will use\nif (browserPath is null || !File.Exists(browserPath))\n    throw new InvalidOperationException($\"Browser executable not found: {browserPath}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    await StartTrackedBrowserAsync();\n}\ncatch (Win32Exception ex) when (ex.Message.Contains(\"CreateProcessW\"))\n{\n    logger.LogError(ex, \"Browser launch failed (Win32 error {Code}). Verify browser install and permissions.\", ex.NativeErrorCode);\n}","preventionTips":["Verify the target browser is installed before enabling tracked browser sessions.","Run app host processes under an account that can spawn child processes.","Check antivirus/EDR exclusions for the browser executable.","Read the inner Win32Exception.NativeErrorCode to diagnose quickly."],"tags":["windows","process-launch","browser","win32"],"backgroundTag":"process-launch-failed","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}