What does HRESULT 0x800401F0 (CO_E_NOTINITIALIZED) mean?

 
Previous Next
MK_E_ENUMERATION_FAILED CO_E_ALREADYINITIALIZED

CO_E_NOTINITIALIZED

CoInitialize has not been called.

CO_E_NOTINITIALIZED has hexadecimal value 0x800401F0 (unsigned 2147746288, signed -2147221008). Windows reports “CoInitialize has not been called.” The narrow interpretation is that the current thread has not initialized the COM library. The failing stage is calling COM APIs that require an apartment before object activation or marshaling.

API stage

  • Associate this result with one exact operation in thread apartment initialization, GUID parsing, class-object discovery, local-server launch, and single-use class-factory registration.
  • Confirm that this result came from calling COM APIs that require an apartment before object activation or marshaling, rather than from cleanup or a wrapper that ran afterward.

Verification steps

  1. Identify the exact object, method, and lifecycle phase involved in calling COM APIs that require an apartment before object activation or marshaling.
  2. Log thread ID, initialization call/result, apartment choice, and uninitialization balance.
  3. Initialize each participating thread explicitly.
  4. Check framework-owned threads and callbacks that may change between invocations.

Interpretation limits

  • It can result when the worker thread never called CoInitializeEx.
  • It can result when initialization was balanced by CoUninitialize before later COM work.
  • It can result when a thread-pool callback assumes COM state inherited from the submitting thread.

Incident record

A useful incident records the thread ID and apartment request, CLSID text, IID text, class context, server executable or DLL path, process launch result, class-factory registration flags, timeout, and activation generation.

  • initialize each participating thread explicitly.

Recovery conditions

Correction: call CoInitializeEx with the correct apartment model at thread entry and pair successful initialization with CoUninitialize. Retry condition. Retry the failed operation only after successful initialization on that same thread. Before repeating the operation, balance successful CoInitializeEx calls on the same thread, revoke only class objects actually registered, and determine whether a local server or single-use factory already served a request.

Practical scenario

A background export task moves from a UI STA to a thread-pool thread; adding per-callback MTA initialization allows COM activation there.

Difference from related HRESULTs

RPC_E_CHANGED_MODE means the thread was initialized incompatibly; it means it was not initialized for the required COM operation.

Developer and administrator guidance

Record the activation phase, parse GUID text before lookup, initialize every participating thread explicitly, and make class-object registration lifetime visible in server state. Regression coverage should include uninitialized and incompatibly initialized threads, malformed CLSID and IID text, missing applications, launch failure, factory-registration races, and single-use consumption.

Verify the registered application and server executable with the supported installation path; thread initialization and class-factory lifetime defects require code fixes rather than registry improvisation.

References


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