BCUninstaller/Bulk-Crap-Uninstaller · warning · ArgumentException

Unknown HRESULT code: 0x{errorCode:X8}

Error message

Unknown HRESULT code: 0x{errorCode:X8}

What it means

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}.

Source

Thrown at source/WinUpdateHelper/Hresult.cs:284

                case 0x8024D011: return "WU_E_SELFUPDATE_REQUIRED - Windows Update Agent must be updated before search can continue.";
                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.";
                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.";
                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.";
                case 0x8024E001: return "WU_E_EE_UNKNOWN_EXPRESSION - An expression evaluator operation could not be completed because an expression was unrecognized.";
                case 0x8024E002: return "WU_E_EE_INVALID_EXPRESSION - An expression evaluator operation could not be completed because an expression was invalid.";
                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.";
                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.";
                case 0x8024E005: return "WU_E_EE_NOT_INITIALIZED - The expression evaluator could not be initialized.";
                case 0x8024E006: return "WU_E_EE_INVALID_ATTRIBUTEDATA - An expression evaluator operation could not be completed because there was an invalid attribute.";
                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.";
                case 0x8024EFFF: return "WU_E_EE_UNEXPECTED - There was an expression evaluator error not covered by another WU_E_EE_* error code.";
                case 0x8024F001: return "WU_E_REPORTER_EVENTCACHECORRUPT - The event cache file was defective.";
                case 0x8024F002: return "WU_E_REPORTER_EVENTNAMESPACEPARSEFAILED - The XML in the event namespace descriptor could not be parsed.";
                case 0x8024F003: return "WU_E_INVALID_EVENT - The XML in the event namespace descriptor could not be parsed.";
                case 0x8024F004: return "WU_E_SERVER_BUSY - The server rejected an event because the server was too busy.";
                case 0x8024FFFF: return "WU_E_REPORTER_UNEXPECTED - There was a reporter error not covered by another error code.";
                default:
                    throw new ArgumentException("Unknown HRESULT code: 0x" + ((uint)errorCode).ToString("X8"));
            }
        }
    }
}

View on GitHub (pinned to 608321de98)

Solutions

  1. Add the missing code as a new case with its documented WU_E_* meaning before the default.
  2. If the code is unknown, change the default to return a formatted fallback string instead of throwing, so callers still get a message.
  3. Cross-check the hex code against Microsoft's Windows Update result-code documentation (UpdateServices) to name it correctly.
  4. Log the raw HRESULT before calling the converter so a thrown default never hides the value.

Example fix

// before
default:
    throw new ArgumentException("Unknown HRESULT code: 0x" + ((uint)errorCode).ToString("X8"));

// after - degrade gracefully and surface the raw code
default:
    return "Unknown HRESULT code: 0x" + ((uint)errorCode).ToString("X8");
Defensive patterns

Strategy: try-catch

Try / catch

string detail;
try { detail = Hresult.ConvertHresultToDetails(ex.ErrorCode); }
catch (ArgumentException) { detail = $"Unknown HRESULT code: 0x{((uint)ex.ErrorCode):X8}"; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BCUninstaller/Bulk-Crap-Uninstaller@608321de98 (2026-08-13). Data as JSON: /api/errors/35bf6409ee31dce0. Report an issue: GitHub.