What does Windows error code 307 (ERROR_INVALID_LOCK_RANGE) mean?

 
Could be also:
ConstantTypeOS
HTTP_STATUS_TEMPORARY_REDIRECTHTTP CodeAny
DPC_WATCHDOG_VIOLATIONBugCheck CodeWindows
Previous Next
ERROR_SECURITY_STREAM_IS_INCONSISTENT ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT

ERROR_INVALID_LOCK_RANGE

The requested file-lock range is not valid

ERROR_INVALID_LOCK_RANGE is returned when the offset and length passed to a locking API do not describe a valid byte range. Overflow, negative signed conversions, or a range that exceeds the supported limit are common causes.

What to inspect

  • Log the starting offset and length before the lock request.
  • Check 32-bit to 64-bit conversions and arithmetic overflow.
  • Ensure the unlock path uses exactly the same range as the successful lock.
  • Verify that the target handle refers to a regular file that supports byte-range locking.

Correction

Validate range arithmetic before calling the API and reject impossible intervals early. Retrying unchanged parameters cannot make an invalid range acceptable.

References


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