What does Windows error code 3061 (ERROR_APPEXEC_HANDLE_INVALIDATED) mean?

 
Previous Next
ERROR_APPEXEC_CONDITION_NOT_SATISFIED ERROR_APPEXEC_INVALID_HOST_GENERATION

ERROR_APPEXEC_HANDLE_INVALIDATED

The supplied AppExec handle has been invalidated.

ERROR_APPEXEC_HANDLE_INVALIDATED is Win32 error 3061 (0xBF5). The AllStat description explicitly says the supplied handle may no longer be used for the requested operation. The handle is opaque, so applications must not assume its lifetime survives host restart, session change, cancellation, or replacement.

How a previously issued handle becomes stale

  • the owning host or broker restarted and invalidated all objects from its previous generation
  • the request was completed, cancelled, closed, or superseded while another thread retained the handle
  • a user, package, or execution context changed and the old object no longer belongs to current state
  • pooling or caching returns a handle after its owner released it
  • asynchronous work races with teardown and begins after invalidation notification

Handle-lifetime telemetry

Record a local correlation ID, creation operation, owner process/service generation, user/session and app identity, creation and invalidation timestamps, last successful operation, cancellation state, thread ownership, and the exact call returning 3061. Do not serialize the opaque handle value or expose it as a user-visible stable identifier.

Diagnostic sequence

Trace the handle from creation to invalidation and prove that every queued user holds explicit lifetime ownership. Correlate broker restart, disconnect, package update, sign-out, cancellation, or request completion. Check whether the owner supplied an invalidation callback or generation value that the client ignored.

Create a fresh handle through the documented owner and repeat a minimal request. If the new object succeeds, focus on cache and teardown ordering. If it also fails, investigate current host conditions rather than reviving the old handle.

Recovery and API design

Release local references, obtain a new handle, rebuild request state, and retry only idempotent operations. An invalidated handle cannot be repaired by sleeping and resubmitting the same value.

Wrap opaque handles in generation-aware noncopyable owners, cancel queued work during teardown, and reject use after invalidation locally. Services should expose a clear reconnect/reacquire boundary to callers.

Difference from invalid host generation

ERROR_APPEXEC_INVALID_HOST_GENERATION names a stale host-generation value. Error 3061 applies to the supplied handle itself, although a host-generation change can be the event that invalidated it.

Example

A client caches an AppExec handle across a broker service restart. Its next request returns 3061. Reconnecting and obtaining a new handle works; retries with the cached value cannot succeed.

References


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