0x80070021SystemMedium

Error 0x80070021 — Lock Violation (ERROR_LOCK_VIOLATION) | Windows System Error Fix

Windows 11Windows 10Windows Server 2022

What Does 0x80070021 Mean?

The process cannot access the file because another process has locked a portion of the file.

Real-World Causes

  1. 1Database application holding byte-range locks on a file
  2. 2Multiple applications trying to write to the same file simultaneously
  3. 3Network file server contention on shared files
  4. 4Application not releasing locks properly after an error

Symptoms

  • Cannot modify a file that another application is using
  • Database operations fail with lock errors
  • Shared files on network drives produce lock errors
  • Backup fails on database files

DIY Fix

Beginner-friendly steps you can try at home

  1. 1Close the application using the file and retry
  2. 2Wait for the other application to finish its operation
  3. 3Restart both applications
  4. 4Copy the file to a local drive to work on it independently

Advanced Fix

For experienced users and IT professionals

  1. 1For network shares, check open files on the server using Computer Management > Shared Folders > Open Files
  2. 2Use Sysinternals Handle.exe to identify and close the file lock

Frequently Asked Questions

What is the difference between sharing violation and lock violation?
A sharing violation occurs when a file is opened with incompatible sharing modes (e.g., one process opens it exclusively). A lock violation occurs when a specific byte range within a file is locked by one process while another tries to access that same range.

Related Error Codes

About the Author

Windows Troubleshooting Team

Verified against official Microsoft documentation and real-world diagnostic data. Error behavior confirmed across Windows 10, Windows 11, and Windows Server.