| Previous | Next |
| DV_E_STATDATA | DV_E_TYMED |
DV_E_LINDEX
Invalid lindex
Windows defines DV_E_LINDEX as 2147745896 (0x80040068; signed value -2147221400). AllStat’s description is “Invalid lindex”. The code marks a specific failure: FORMATETC::lindex is invalid for the requested aspect or data format. The relevant operation is validating a FORMATETC before GetData, QueryGetData, SetData, or cache negotiation.
The high bit in 0x80040068 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 104 (0x0068). 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 this result remain essential.
Where it is raised
Understanding this result requires this subsystem context: COM data-transfer structures are compound contracts: a field can be numerically well formed yet invalid for the provider, object generation, requested aspect, or ownership rules. Diagnosis therefore has to preserve the complete descriptor and the exact method that consumed it.
- Associate this result with one exact operation in IDataObject, FORMATETC/STGMEDIUM negotiation, data advisory enumeration, or OLE rendering.
- Confirm that this result came from validating a FORMATETC before GetData, QueryGetData, SetData, or cache negotiation, rather than from cleanup or a wrapper that ran afterward.
- Preserve any IErrorInfo, underlying Win32 result, provider message, or callback failure that preceded it; the HRESULT alone should not erase a more specific cause.
Telemetry checklist
A useful incident records the IDataObject identity, method, clipboard format, aspect, lindex, tymed mask, target-device size, advisory cookie, and ownership of every returned interface or medium. 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 it, redact content and credentials while preserving types, lengths, hashes, opaque identities, and lifecycle generations needed to reproduce its contract.
- record the exact signed lindex value and the selected DVASPECT.
- enumerate supported FORMATETC values and compare index semantics, not only cfFormat.
- check structure packing and language interop where -1 can become 4294967295.
Why it is specific
- It can result when the caller passes a nonnegative index for a format that is not page-oriented.
- It can result when the index is outside the provider-defined range for a multi-page or multi-item representation.
- It can result when a wrapper converts the documented -1 sentinel to an unsigned or truncated value.
Investigation order
- Capture it at the first native return before a wrapper maps it to a generic exception.
- Identify the exact object, method, and lifecycle phase involved in validating a FORMATETC before GetData, QueryGetData, SetData, or cache negotiation.
- Reproduce it with one controlled input or state change, and verify that the correction changes the decisive evidence rather than merely hiding the result.
Safe handling
Correction. for it, use the index contract advertised for that format, commonly -1 when the entire aspect rather than one page is requested. Retry boundary. A retry is safe after correcting lindex before any medium is transferred; do not loop with the same index. Before repeating the operation, release every returned STGMEDIUM according to pUnkForRelease, retain advisory cookies only after successful DAdvise, and discard enumerated formats after the data object is replaced.
Practical scenario
A preview handler requests DVASPECT_CONTENT with lindex 0 even though the source supports only the whole presentation at lindex -1; changing only lindex makes QueryGetData succeed. This isolates it within COM data transfer and advisory connections and provides a regression test for the stated correction.
Difference from related HRESULTs
DV_E_DVASPECT rejects the aspect value; it says the selected position within that aspect is invalid. Keep those outcomes separate in exception mappings, telemetry dimensions, user messages, and automated retry policy.
Developer and administrator guidance
Copy complete FORMATETC and DVTARGETDEVICE structures, preserve signed lindex values, intersect tymed masks before requesting data, and encode STGMEDIUM ownership explicitly. Regression coverage for it should include provider-advertised versus caller-invented formats, supported and unsupported DVASPECT/tymed combinations, sentinel lindex values, malformed target-device sizes, and replacement during advisory callbacks.
Operational repair for it must target the evidence-backed owner: compare the data provider, consumer, and registered handler versions; repair a handler only when traces identify that provider as missing or incompatible. Retain before-and-after traces for it so the change can be attributed and reversed.
References
- Microsoft: generic COM error codes
- Microsoft: HRESULT values
- Microsoft: IDataObject
- Microsoft: FORMATETC structure
- Microsoft: IViewObject
Looking for a different code? Search another status or error code.