Quick answer: Close any program that has the file open (especially explorer.exe if the file is on a network share), then retry your operation. If that doesn't work, disable oplocks via registry.
Why you're seeing this
This error means your application tried to open a file that another program already has locked via an opportunistic lock (oplock). Oplocks let a program cache file data for faster reads, but they block other programs from writing to that file. You'll typically see this when:
- You're running a backup tool or antivirus that scans a network share while another app holds the file.
- You're using a database or virtualization software (like VMware or Hyper-V) that needs exclusive access to a file on an SMB share.
- You've got a file open in Notepad, Excel, or any editor on a mapped drive, and then another process tries to modify it.
This is not a hardware problem or driver issue. It's a file locking conflict, pure and simple.
Fix steps
- Identify what has the file open. Open Task Manager (Ctrl+Shift+Esc). Go to the Details tab. Look for any process like
explorer.exe,notepad.exe,Excel.exe, or your backup software. If you see a process namedsmb.exeorsvchost.exewith high disk activity, that's the SMB client holding the oplock. - Close the program holding the lock. Right-click the process and select End Task. If it's
explorer.exe, your taskbar and desktop will disappear — that's normal. After ending it, press Ctrl+Shift+Esc again to open a new Task Manager, click File > Run new task, typeexplorer.exe, and hit Enter. That restarts the shell and should release any oplocks. - Retry your original operation. If the error is gone, you're done. The oplock was broken by closing the owner process.
- If the error still appears, check for hidden handles. Download Microsoft's Handle tool from Sysinternals. Run
handle.exe -a <path-to-file>in an admin command prompt. It will list every process with a handle on that file. Kill those processes withtaskkill /f /pid <pid>. - If you still can't break the oplock, disable oplocks entirely. This is a nuclear option — it will slow down network file reads because caching is turned off. Open Registry Editor (regedit) as admin. Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters. Create a new DWORD (32-bit) calledEnableOplocksand set it to0. Restart the Server service or reboot. After that, the error should stop, but your file access over the network will be slower.
Alternative fixes if the main one fails
- Copy the file locally. If it's a network file, copy it to your local drive, make your changes, then copy it back. That bypasses the oplock entirely because local files use different locking mechanisms.
- Use a different protocol. Switch from SMB to iSCSI or NFS if your storage supports it. Those protocols handle locks differently and don't rely on oplocks.
- Update your network driver. I've seen buggy Realtek or Intel network drivers cause oplock timeouts that lead to this error. Go to your motherboard or laptop manufacturer's site and install the latest LAN driver. Windows Update often gives stale ones.
- Check antivirus settings. Some antivirus software (looking at you, McAfee and Norton) can hold file handles open for too long. Temporarily disable real-time scanning and see if the error goes away. If it does, add an exclusion for the network share or folder where the problem happens.
Prevention tip
Once you fix it, don't keep files open on network shares when you're not actively using them. Close Excel, Notepad, or any editor after you save. That's the single most reliable way to avoid this error. If you see it a lot in a backup or database app, talk to your IT team about disabling oplocks on the server side — it's a permanent fix, but it'll cost you some network performance.