| Previous | Next |
| STG_E_ACCESSDENIED | STG_E_INSUFFICIENTMEMORY |
STG_E_INVALIDHANDLE
Structured-storage object or handle is invalid
STG_E_INVALIDHANDLE is HRESULT 2147680262 (0x80030006) from winerror.h. The documented description is “Attempted an operation on an invalid object.” The result belongs to use of a storage, stream, enumerator, lock-bytes object, or underlying handle. Interpret this result at the native boundary before a wrapper hides the condition that the operation references an object identity that is no longer valid for the requested storage call.
STG_E_INVALIDHANDLE means that the operation references an object identity that is no longer valid for the requested storage call.
Where the result appears
- This result can surface in a IStorage, IStream, ILockBytes, property storage, compound-file parsing, or persistence code.
- Map the failure to one concrete operation among StgOpenStorage, StgCreateStorageEx, IStorage, IStream, IPropertyStorage, STATSTG, and the selected STGM mode.
- Preserve storage path or identity, STGM mode, stream or storage name, transaction generation, file hash, and backing provider before releasing or replacing the object that returned this result.
An incident record must distinguish caller, runtime, provider, and backing resource while testing whether the operation references an object identity that is no longer valid for the requested storage call.
Typical causes and interpretation
The immediate contract boundary is specific: the operation references an object identity that is no longer valid for the requested storage call. Common cause branches include the following:
- The caller retained an interface after its parent storage was reverted or closed.
- A native handle was closed or replaced before the COM wrapper used it.
- Memory corruption changed the object or handle value.
Confirm the cause branch that explains why the operation references an object identity that is no longer valid for the requested storage call by using call arguments, object state, metadata, device information, or provider traces.
Correct handling and recovery
The primary recovery is to reacquire the object from the current parent generation and fix lifetime ownership rather than reusing the stale reference. The failure report should capture the relevant state during use of a storage, stream, enumerator, lock-bytes object, or underlying handle so it is clear why the operation references an object identity that is no longer valid for the requested storage call.
A UI loop must not repeat it without refreshing the state behind “the operation references an object identity that is no longer valid for the requested storage call” and checking for prior side effects.
Practical scenario
A background saver keeps an IStream pointer after the document storage is replaced during reload, then attempts to commit through the obsolete stream.
Difference from related HRESULTs
STG_E_REVERTED identifies invalidation by a storage revert; it is broader and does not prove that revert caused the invalid object.
Developer and administrator guidance
Dashboards should keep it distinct and attach dimensions that can prove or disprove: the operation references an object identity that is no longer valid for the requested storage call.
References
Looking for a different code? Search another status or error code.