What does HRESULT 0x80670002 (STATEREPOSITORY_E_STATEMENT_INPROGRESS) mean?

 
Previous Next
STATEREPOSITORY_E_CONCURRENCY_LOCKING_FAILURE STATEREPOSITORY_E_CONFIGURATION_INVALID

STATEREPOSITORY_E_STATEMENT_INPROGRESS

The scope of STATEREPOSITORY_E_STATEMENT_INPROGRESS is Windows StateRepository: a prepared statement was reused or finalized before stepping to completion or resetting it. Preserve 0x80670002 beside the returning call before cleanup or retry creates a more generic secondary failure.

Wrong turns

When it is returned, STATEREPOSITORY_E_BUSY_RETRY is external contention; STATEMENT_INPROGRESS is misuse of a statement already owned by the caller.

Do not add sleep-based retries while the unfinished statement remains active.

Object and state boundary

When it is returned, StateRepository is infrastructure for the Windows application model. During a this result investigation, the HRESULTs expose distinctions familiar from transactional stores: optimistic concurrency, an unfinished prepared statement, database-versus-table locking, shared-cache contention, recovery, schema compatibility, corruption, and service shutdown. These are not interchangeable reasons to delete the repository.

During a this result investigation, prepared statements have a lifecycle: bind, step until done, then reset or finalize. Leaving a row-producing statement partially stepped can retain locks and make later use of the same connection appear mysteriously busy.

The first owner to inspect is the StateRepository request, database connection, prepared statement, transaction, schema generation, or service lifecycle that rejected the operation.

Capture before retry

CaptureDiagnostic value
SQL or statement identity for it.This separates caller input from environment and service state and helps test the Windows StateRepository boundary.
Last sqlite3_step-style result for it.This provides a stable comparison across retries or another machine and helps test the Windows StateRepository boundary.
Remaining rows for it.This identifies the exact object or resource generation involved and helps test the Windows StateRepository boundary.
Reset/finalize and connection ownership for it.This places the failure on the lifecycle or transaction timeline and helps test the Windows StateRepository boundary.

Controlled comparisons

ControlInterpretationHold constant
Same database copy, isolated connectionsA change points to connection/statement/transaction ownership rather than stored content.While diagnosing this result, use a copy and preserve schema plus repository generation.
Same object, reduced operationIf the result follows one specific transition, statement, file, or ceremony step, the failure is localized.While diagnosing this result, remove only unrelated work and keep the first failing boundary visible.
Same operation, controlled environmentIf the result follows one machine, account, volume, network, or device, environment matters.While diagnosing it, keep versions and identity explicit rather than comparing only the final message.

Step-by-step investigation

The investigation should change one variable at a time and keep the original failing sample.

  1. First: Consume the result to completion or reset explicitly.
  2. Next: Use scope-based statement cleanup.
  3. Then: Avoid sharing one statement concurrently.
  4. Finally: Log statement state before transaction commit.

Closure criteria

Closure for it requires every statement reaches done, reset, or finalize on all success and error paths; then repeat the next lifecycle operation to detect stale state.

Technical references

The references below define the API family or storage/protocol behavior used to interpret it.


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