What does Windows error code 158 (ERROR_NOT_LOCKED) mean?

 
Could be also:
ConstantTypeOS
USER_MODE_HEALTH_MONITORBugCheck CodeWindows
Previous Next
ERROR_DISCARDED ERROR_BAD_THREADID_ADDR

ERROR_NOT_LOCKED

There is no matching lock to release

ERROR_NOT_LOCKED occurs when code tries to release a lock that was never acquired, was already released, or uses a different range or ownership context.

Checks

  • Pair each successful lock with exactly one unlock.
  • Verify file-region offset and length values match.
  • Review cleanup paths for duplicate release.
  • Track ownership when locks move across threads or components.

Fix

Correct the lock-state model. Ignoring the result can hide a more serious ownership bug.

References


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