How to fix Error 307 on Windows 11

Troubleshooting Guide: Error 307 – Invalid Byte Range File Lock Failure

Why This Error Happens

Error 307 occurs when an application requests a byte-range file lock that falls outside the actual boundaries of the file, or when the specified range overlaps with an already-locked region held by another process. This typically stems from a corrupted or truncated file, a mismatch between the file’s reported size and its actual on-disk size (often due to abrupt process termination or interrupted writes), or a faulty third-party filter driver (such as antivirus or backup software) that intercepts and mismanages I/O requests. Network file systems (SMB/NFS shares) are especially prone to this issue when latency or caching causes stale file metadata to be used during the lock request.

Step-by-Step Resolution Guide

  1. Check File Integrity via System File Checker
    Open Command Prompt as Administrator and run:
   sfc /scannow

Follow up with:

   DISM /Online /Cleanup-Image /RestoreHealth

This repairs corrupted system files that may be triggering invalid lock requests.

  1. Identify and Close the Locking Process
    Use Resource Monitor (resmon.exe) → CPU tab → Associated Handles, and search for the problematic file name. Identify which process holds an active lock and close it gracefully, or terminate it via Task Manager if unresponsive.

  2. Disable Third-Party Filter Drivers Temporarily
    Boot into Clean Boot mode (msconfig → Services tab → check “Hide all Microsoft services” → Disable all) to rule out antivirus or backup software filter drivers interfering with file I/O. If the error disappears, update or reinstall the conflicting software.

  3. Verify File Size Consistency on Network Shares
    If the file resides on a mapped network drive, disconnect and remap it:

   net use Z: /delete
   net use Z: \\ServerName\ShareName /persistent:yes

This forces Windows to refresh cached file metadata, resolving mismatches between reported and actual file size.

  1. Update Storage and Network Drivers
    Go to Settings → Windows Update → Advanced Options → Optional Updates → Driver Updates, and install any pending updates for storage controllers or network adapters, as outdated drivers can mishandle lock range calculations.

Alternative or Verification Steps

  • Verify the fix: Reopen the affected file/application and monitor Event Viewer (eventvwr.msc → Windows Logs → Application) to confirm Error 307 no longer appears during file operations.
  • Alternative fix: If the issue persists only on a specific file, copy its contents to a newly created file and delete the original — this bypasses any residual corrupted lock metadata tied to the old file’s file table entry.