{"record":{"id":"35bf6409ee31dce0","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"unknown-hresult-code-0x-errorcode-x8","errorCode":null,"errorMessage":"Unknown HRESULT code: 0x{errorCode:X8}","messagePattern":"Unknown HRESULT code: 0x(.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"source/WinUpdateHelper/Hresult.cs","lineNumber":284,"sourceCode":"                case 0x8024D011: return \"WU_E_SELFUPDATE_REQUIRED - Windows Update Agent must be updated before search can continue.\";\r\n                case 0x8024D012: return \"WU_E_SELFUPDATE_REQUIRED_ADMIN - Windows Update Agent must be updated before search can continue. An administrator is required to perform the operation.\";\r\n                case 0x8024D013: return \"WU_E_SETUP_WRONG_SERVER_VERSION - Windows Update Agent could not be updated because the server does not contain update information for this version.\";\r\n                case 0x8024DFFF: return \"WU_E_SETUP_UNEXPECTED - Windows Update Agent could not be updated because of an error not covered by another WU_E_SETUP_* error code.\";\r\n                case 0x8024E001: return \"WU_E_EE_UNKNOWN_EXPRESSION - An expression evaluator operation could not be completed because an expression was unrecognized.\";\r\n                case 0x8024E002: return \"WU_E_EE_INVALID_EXPRESSION - An expression evaluator operation could not be completed because an expression was invalid.\";\r\n                case 0x8024E003: return \"WU_E_EE_MISSING_METADATA - An expression evaluator operation could not be completed because an expression contains an incorrect number of metadata nodes.\";\r\n                case 0x8024E004: return \"WU_E_EE_INVALID_VERSION - An expression evaluator operation could not be completed because the version of the serialized expression data is invalid.\";\r\n                case 0x8024E005: return \"WU_E_EE_NOT_INITIALIZED - The expression evaluator could not be initialized.\";\r\n                case 0x8024E006: return \"WU_E_EE_INVALID_ATTRIBUTEDATA - An expression evaluator operation could not be completed because there was an invalid attribute.\";\r\n                case 0x8024E007: return \"WU_E_EE_CLUSTER_ERROR - An expression evaluator operation could not be completed because the cluster state of the computer could not be determined.\";\r\n                case 0x8024EFFF: return \"WU_E_EE_UNEXPECTED - There was an expression evaluator error not covered by another WU_E_EE_* error code.\";\r\n                case 0x8024F001: return \"WU_E_REPORTER_EVENTCACHECORRUPT - The event cache file was defective.\";\r\n                case 0x8024F002: return \"WU_E_REPORTER_EVENTNAMESPACEPARSEFAILED - The XML in the event namespace descriptor could not be parsed.\";\r\n                case 0x8024F003: return \"WU_E_INVALID_EVENT - The XML in the event namespace descriptor could not be parsed.\";\r\n                case 0x8024F004: return \"WU_E_SERVER_BUSY - The server rejected an event because the server was too busy.\";\r\n                case 0x8024FFFF: return \"WU_E_REPORTER_UNEXPECTED - There was a reporter error not covered by another error code.\";\r\n                default:\r\n                    throw new ArgumentException(\"Unknown HRESULT code: 0x\" + ((uint)errorCode).ToString(\"X8\"));\r\n            }\r\n        }\r\n    }\r\n}","sourceCodeStart":266,"sourceCodeEnd":288,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/WinUpdateHelper/Hresult.cs#L266-L288","documentation":"ArgumentException thrown by the default case of Hresult.ConvertHresultToDetails when a Windows Update COM HRESULT does not match any enumerated case in the large switch. The function is a lookup table translating WU_E_* / WU_S_* codes into human-readable strings; an unmapped code is a gap in the table rather than an invalid value. The message includes the code formatted as 0x{X8}.","triggerScenarios":"A COMException from WUApiLib carries an ErrorCode that is a real Windows Update HRESULT but was never added to the switch (e.g. a newer WU code), or a non-WU HRESULT surfaced through the WU pipeline. Program.Main's catch(COMException) calls ConvertHresultToDetails(ex.ErrorCode) and this throws instead of returning text.","commonSituations":"Microsoft adds new WU HRESULTs in a Windows feature update that predate this lookup table. The COM error originates from a related subsystem (COM marshalling, RPC, BITS) whose HRESULTs were never part of the WU_E_* catalog. The ErrorCode is actually a success/info code outside the 0x24xxxx range.","solutions":["Add the missing code as a new case with its documented WU_E_* meaning before the default.","If the code is unknown, change the default to return a formatted fallback string instead of throwing, so callers still get a message.","Cross-check the hex code against Microsoft's Windows Update result-code documentation (UpdateServices) to name it correctly.","Log the raw HRESULT before calling the converter so a thrown default never hides the value."],"exampleFix":"// before\ndefault:\n    throw new ArgumentException(\"Unknown HRESULT code: 0x\" + ((uint)errorCode).ToString(\"X8\"));\n\n// after - degrade gracefully and surface the raw code\ndefault:\n    return \"Unknown HRESULT code: 0x\" + ((uint)errorCode).ToString(\"X8\");","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"string detail;\ntry { detail = Hresult.ConvertHresultToDetails(ex.ErrorCode); }\ncatch (ArgumentException) { detail = $\"Unknown HRESULT code: 0x{((uint)ex.ErrorCode):X8}\"; }","preventionTips":["Wrap ConvertHresultToDetails so an unmapped code does not crash the host.","Log the raw ErrorCode before converting so the value is never lost.","Consider patching the default to return a formatted string instead of throwing."],"tags":["hresult","windows-update","lookup-table","com","wu"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}