What does HRESULT 0x80040E50 (DB_E_BADSOURCEHANDLE) mean?

 
Previous Next
DB_E_CHAPTERNOTRELEASED DB_E_PARAMUNAVAILABLE

DB_E_BADSOURCEHANDLE

Meaning

Windows documents DB_E_BADSOURCEHANDLE as “Source handle is invalid”. In this case, a provider receives a source handle that is invalid for the current source object or operation; the public text does not identify a single owning API.

Relevant contract

Storage-object access transfers COM interface pointers for long or object-valued data. Some providers allow only one live storage object for a row or source, and every returned handle or interface remains scoped to the object and operation that created it.

Investigation of this result should start with the row, source handle and every open ISequentialStream, IStream or provider-specific storage interface.

Conditions that specifically lead to the result

  • Cause 1: the handle was released or never initialized.
  • Cause 2: the handle belongs to another provider object or generation.
  • Cause 3: a numeric copy of a provider-owned handle crossed an invalid lifetime boundary.

Evidence to collect

  • Evidence 1: the exact IID and method accepting the source handle.
  • Evidence 2: the object that originally issued the handle.
  • Evidence 3: creation, transfer and release events for that handle.

Diagnostic sequence

  1. Identify the exact failing stage: a provider receives a source handle that is invalid for the current source object or operation; the public text does not identify a single owning API.

Corrective actions

  • Action 1: treat the source handle as opaque and object-scoped.
  • Action 2: reacquire it from the current source object.
  • Action 3: remove serialization or cross-object caching of provider handles.

Retry and recovery

Retry rule: retry only with a freshly issued handle whose owner and lifetime are proven.

Practical scenario

A cache stores a source handle after its view is rebuilt; reacquiring the handle from the new view prevents the invalid-source result.

Difference from nearby HRESULT values

DB_E_BADROWHANDLE identifies an invalid HROW, while DB_E_BADSOURCEHANDLE refers to a different provider-defined source handle.

Official Microsoft references


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