{"record":{"id":"57d81e05c210f9ee","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"update-installer-is-busy","errorCode":null,"errorMessage":"Update installer is busy","messagePattern":"Update installer is busy","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"source/WinUpdateHelper/UpdateManager.cs","lineNumber":66,"sourceCode":"                case OperationResultCode.orcSucceeded:\r\n                    break;\r\n                case OperationResultCode.orcSucceededWithErrors:\r\n                    break;\r\n                case OperationResultCode.orcFailed:\r\n                    throw new COMException(\"Selected update is not uninstallable\", result.HResult);\r\n                case OperationResultCode.orcAborted:\r\n                    throw new OperationCanceledException(\"Selected update is not uninstallable\");\r\n            }\r\n            Console.WriteLine(\"Uninstall successful\");\r\n        }\r\n\r\n        private static void WaitForInstallerBusy(IUpdateInstaller wuaInstaller)\r\n        {\r\n            var count = 0;\r\n            // Wait for some seconds\r\n            while (wuaInstaller.IsBusy && count++ < 30) Thread.Sleep(250);\r\n            if (count >= 20)\r\n                throw new TimeoutException(\"Update installer is busy\");\r\n        }\r\n\r\n        public static void WriteUpdateList()\r\n        {\r\n            var wuaSession = new UpdateSessionClass();\r\n            var wuaSearcher = wuaSession.CreateUpdateSearcher();\r\n            var wuaSearch = wuaSearcher.Search(\"IsInstalled=1 and IsPresent=1 and Type='Software'\");\r\n            var updates = wuaSearch.Updates.OfType<IUpdate>().ToList();\r\n            \r\n            foreach (var update in updates)\r\n            {\r\n                var id = update.Identity;\r\n\r\n                var result = HelperTools.KeyValueListToConsoleOutput(new List<KeyValuePair<string, object>>\r\n                {\r\n                    new(nameof(id.UpdateID), id.UpdateID),\r\n                    new(nameof(id.RevisionNumber), id.RevisionNumber),\r\n\r","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/WinUpdateHelper/UpdateManager.cs#L48-L84","documentation":"TimeoutException thrown by WaitForInstallerBusy when the WU installer reports IsBusy for too long. The method loops while wuaInstaller.IsBusy && count++ < 30 (sleeping 250ms each iteration, so up to ~7.5s) but throws once count >= 20 (~5s of sustained busy). It is called both before and after Uninstall(), so it guards against an installer that is already busy (pre) or never finishes (post). Note the loop ceiling (30) and throw threshold (20) differ, so the effective wait is the lower bound.","triggerScenarios":"IUpdateInstaller.IsBusy stays true: another uninstall/install is in progress on the same installer object or WU session, the installer object was reused across operations, or the servicing stack is hung. Called right after Uninstall() when the operation is long-running.","commonSituations":"Reusing a single UpdateInstaller instance for multiple operations without waiting. A prior WU job still settling. Slow servicing stack on a busy/low-resource machine. Antivirus scanning the update payload stalling the installer.","solutions":["Use a fresh IUpdateInstaller per operation instead of reusing a busy one.","Ensure no other WU operation is in flight (check Settings / wuauclt) before starting.","If legitimately slow, raise the count thresholds (and align the loop ceiling with the throw condition) to allow more wait time.","Investigate a stuck installer via CBS.log / WindowsUpdate.log and restart wuauserv if hung."],"exampleFix":"// before - inconsistent thresholds, short effective wait\nwhile (wuaInstaller.IsBusy && count++ < 30) Thread.Sleep(250);\nif (count >= 20) throw new TimeoutException(\"Update installer is busy\");\n\n// after - aligned budget with a configurable timeout\nvar deadline = DateTime.UtcNow.Add(TimeSpan.FromSeconds(30));\nwhile (wuaInstaller.IsBusy && DateTime.UtcNow < deadline) Thread.Sleep(250);\nif (wuaInstaller.IsBusy)\n    throw new TimeoutException(\"Update installer is busy\");","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for (int attempt = 0; attempt < 2; attempt++)\n{\n    try { UpdateManager.UninstallUpdate(id); break; }\n    catch (TimeoutException ex) when (ex.Message == \"Update installer is busy\" && attempt == 0)\n    { /* wait and retry once */ Thread.Sleep(TimeSpan.FromSeconds(10)); }\n}","preventionTips":["Use a fresh IUpdateInstaller per operation rather than reusing a busy one.","Ensure no other WU job is in flight before uninstalling.","Align the loop ceiling and throw threshold if you need a longer wait, or switch to a deadline-based wait."],"tags":["windows-update","wu","timeout","installer-busy","wua","uninstall"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}