What does HRESULT 0x80040156 (REGDB_E_BADTHREADINGMODEL) mean?

 
Previous Next
REGDB_E_IIDNOTREG REGDB_E_PACKAGEPOLICYVIOLATION

REGDB_E_BADTHREADINGMODEL

Threading model entry is not valid

Windows defines REGDB_E_BADTHREADINGMODEL as 2147746134 (0x80040156; signed value -2147221162). The documented description is “Threading model entry is not valid”. The InprocServer32 ThreadingModel registration contains an unsupported value. The relevant operation is loading an in-process COM server into a caller apartment.

Where it is raised

COM registration is architecture-, scope-, and identity-sensitive. A key visible in Registry Editor is not proof that the failing process sees the same view or that the values form a coherent activation contract.

  • Associate this result with one exact operation in CLSID/IID registry lookup, InprocServer32 or LocalServer32 metadata, interface proxy registration, package policy, and threading-model interpretation.
  • Confirm that this result came from loading an in-process COM server into a caller apartment, rather than from cleanup or a wrapper that ran afterward.

Telemetry checklist

  • Capture the literal ThreadingModel text and the class CLSID.
  • Compare the server implementation with the apartment model it actually supports.
  • Test registration in a clean machine image to detect upgrade residue.

Why it is specific

  • It can result when ThreadingModel is misspelled or contains an unrecognized custom value.
  • It can result when manual registration writes a display label instead of Apartment, Free, Both, or Neutral.
  • It can result when a package or installer merges incompatible registration fragments from different builds.

Investigation order

  1. Identify the exact object, method, and lifecycle phase involved in loading an in-process COM server into a caller apartment.

Safe handling

Correction. repair the registration through the component installer and align it with the server’s real threading implementation. Retry condition. Do not reinterpret the bad value or default silently; retry only after registration is corrected and the server is loaded in a new process. Before repeating the operation, complete or roll back the installer transaction, re-read the exact user or machine registry view, and discard class factories obtained from superseded registration.

Practical scenario

An installer writes “MTA” instead of the documented “Free” value; changing the authored installer data, not the application, resolves activation.

Difference from related HRESULTs

RPC_E_CHANGED_MODE concerns a thread already initialized with another apartment model; it concerns invalid server registration.

Developer and administrator guidance

References


Looking for a different code? Search another status or error code.