{"record":{"id":"ff6460c733216949","repo":"microsoft/aspire","slug":"failed-to-invoke-updateprocthreadattribute-while-starting","errorCode":null,"errorMessage":"Failed to invoke UpdateProcThreadAttribute while starting tracked browser CDP pipe.","messagePattern":"Failed to invoke UpdateProcThreadAttribute while starting tracked browser CDP pipe\\.","errorType":"exception","errorClass":"Win32Exception","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Browsers/BrowserLogsPipeBrowserProcessLauncher.Windows.cs","lineNumber":105,"sourceCode":"            {\n                throw CreateWindowsException(\"InitializeProcThreadAttributeList\");\n            }\n\n            for (var i = 0; i < inheritedHandles.Length; i++)\n            {\n                Marshal.WriteIntPtr(handleList, i * IntPtr.Size, inheritedHandles[i]);\n            }\n\n            if (!UpdateProcThreadAttribute(\n                attributeList,\n                0,\n                s_procThreadAttributeHandleList,\n                handleList,\n                (UIntPtr)(uint)(IntPtr.Size * inheritedHandles.Length),\n                IntPtr.Zero,\n                IntPtr.Zero))\n            {\n                throw CreateWindowsException(\"UpdateProcThreadAttribute\");\n            }\n\n            var startupInfo = new STARTUPINFOEX\n            {\n                StartupInfo = new STARTUPINFO\n                {\n                    cb = Marshal.SizeOf<STARTUPINFOEX>()\n                },\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,","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Browsers/BrowserLogsPipeBrowserProcessLauncher.Windows.cs#L87-L123","documentation":"A Win32Exception wrapping GetLastError from UpdateProcThreadAttribute in CreateWindowsProcess (BrowserLogsPipeBrowserProcessLauncher.Windows.cs:105). Aspire sets PROC_THREAD_ATTRIBUTE_HANDLE_LIST so only the two anonymous-pipe handles are inheritable by the Chromium child; failure means the handle-list attribute could not be attached and the browser process is not launched.","triggerScenarios":"UpdateProcThreadAttribute returns FALSE during StartWindows — typically ERROR_INVALID_HANDLE (one of the two pipe client handles is invalid/closed), ERROR_INVALID_PARAMETER, or ERROR_NOT_ENOUGH_MEMORY.","commonSituations":"Pipe handles invalidated by another component closing them; security software tampering with handle values; memory pressure; misaligned attribute-list state from a prior failed InitializeProcThreadAttributeList.","solutions":["Read NativeErrorCode: ERROR_INVALID_HANDLE(6) — verify the AnonymousPipeServerStream client handles were not disposed before CreateProcess.","ERROR_NOT_ENOUGH_MEMORY: free memory / raise the container limit and retry.","Exclude antivirus/EDR process-creation hooking for the AppHost process.","Update to the latest Aspire version and, if persistent, file an issue with the Win32 error code.","Fall back to the WebSocket CDP transport if the pipe transport keeps failing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static bool IsUpdateAttrFailure(Win32Exception ex) => ex.Message.Contains(\"UpdateProcThreadAttribute\");","tryCatchPattern":"try\n{\n    StartBrowserPipeWindows();\n}\ncatch (Win32Exception ex) when (IsUpdateAttrFailure(ex))\n{\n    logger.LogError(ex, \"UpdateProcThreadAttribute failed (Win32 error {Errno}); verify CDP pipe handles are still valid.\", ex.NativeErrorCode);\n    throw;\n}","preventionTips":["Never dispose the AnonymousPipeServerStream (or its client handles) before CreateProcess completes.","Exclude EDR/AV handle tampering for the AppHost process.","Watch for ERROR_INVALID_HANDLE (6) as a sign of handle-lifecycle bugs.","Use the WebSocket CDP transport as an alternative if failures persist."],"tags":["windows","win32","handle-inheritance","browser"],"backgroundTag":"process-spawn-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"}