| 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). AllStat records “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.
The high bit in 0x800401F0 is set, so this is a failure rather than a success or informational result. Its facility field is 4 (FACILITY_ITF) and its low 16-bit code is 496 (0x01F0). Those bit fields classify the value, but they do not identify the failing object by themselves; the native method, object identity, and first producer of CO_E_NOTINITIALIZED remain essential.
API stage
Understanding CO_E_NOTINITIALIZED requires this subsystem context: Early COM activation has discrete phases: thread initialization, identifier parsing, registration lookup, server launch, and class-factory registration. For CO_E_NOTINITIALIZED, preserve the first phase-specific result before a framework collapses it into a generic activation exception.
- Associate
CO_E_NOTINITIALIZEDwith one exact operation in thread apartment initialization, GUID parsing, class-object discovery, local-server launch, and single-use class-factory registration. - Confirm that
CO_E_NOTINITIALIZEDcame from calling COM APIs that require an apartment before object activation or marshaling, rather than from cleanup or a wrapper that ran afterward. - Preserve any IErrorInfo, underlying Win32 result, provider message, or callback failure that preceded
CO_E_NOTINITIALIZED; the HRESULT alone should not erase a more specific cause.
Verification steps
- Capture
CO_E_NOTINITIALIZEDat the first native return before a wrapper maps it to a generic exception. - Identify the exact object, method, and lifecycle phase involved in calling COM APIs that require an apartment before object activation or marshaling.
- Log thread ID, initialization call/result, apartment choice, and uninitialization balance.
- Initialize each participating thread explicitly.
- Check framework-owned threads and callbacks that may change between invocations.
- Reproduce
CO_E_NOTINITIALIZEDwith one controlled input or state change, and verify that the correction changes the decisive evidence rather than merely hiding the result.
Interpretation limits
CO_E_NOTINITIALIZEDcan result when the worker thread never called CoInitializeEx.CO_E_NOTINITIALIZEDcan result when initialization was balanced by CoUninitialize before later COM work.CO_E_NOTINITIALIZEDcan result when a thread-pool callback assumes COM state inherited from the submitting thread.
Incident record
A useful CO_E_NOTINITIALIZED 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. For CO_E_NOTINITIALIZED, also retain the application and component build, architecture, process and thread IDs, COM apartment, operation correlation ID, elapsed time, and the first state-changing event before the failure. When logging CO_E_NOTINITIALIZED, redact content and credentials while preserving types, lengths, hashes, opaque identities, and lifecycle generations needed to reproduce its contract.
- For
CO_E_NOTINITIALIZED, log thread ID, initialization call/result, apartment choice, and uninitialization balance. - For
CO_E_NOTINITIALIZED, initialize each participating thread explicitly. - For
CO_E_NOTINITIALIZED, check framework-owned threads and callbacks that may change between invocations.
Recovery conditions
Correction. For CO_E_NOTINITIALIZED, call CoInitializeEx with the correct apartment model at thread entry and pair successful initialization with CoUninitialize. Retry boundary. Retry the failed operation only after successful initialization on that same thread. Before repeating the CO_E_NOTINITIALIZED 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. This isolates CO_E_NOTINITIALIZED within COM initialization and early activation and provides a regression test for the stated correction.
Difference from related HRESULTs
RPC_E_CHANGED_MODE means the thread was initialized incompatibly; CO_E_NOTINITIALIZED means it was not initialized for the required COM operation. For CO_E_NOTINITIALIZED, keep those outcomes separate in exception mappings, telemetry dimensions, user messages, and automated retry policy.
Developer and administrator guidance
For CO_E_NOTINITIALIZED, 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 for CO_E_NOTINITIALIZED should include uninitialized and incompatibly initialized threads, malformed CLSID and IID text, missing applications, launch failure, factory-registration races, and single-use consumption.
Operational repair for CO_E_NOTINITIALIZED must target the evidence-backed owner: 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. Retain before-and-after traces for CO_E_NOTINITIALIZED so the change can be attributed and reversed.
References
- Microsoft: generic COM error codes — official Microsoft documentation relevant to
CO_E_NOTINITIALIZED. - Microsoft: HRESULT values — official Microsoft documentation relevant to
CO_E_NOTINITIALIZED. - Microsoft: CoInitializeEx — official Microsoft documentation relevant to
CO_E_NOTINITIALIZED. - Microsoft: CoGetClassObject — official Microsoft documentation relevant to
CO_E_NOTINITIALIZED. - Microsoft: CoRegisterClassObject — official Microsoft documentation relevant to
CO_E_NOTINITIALIZED.
Looking for a different code? Search another status or error code.