general

File Locked Errors

Resolution Checklist

  • 1 Understand File Locking Mechanics in Cloud Storage
  • 2 Release File Locks on Windows Using Resource Monitor and PowerShell
  • 3 Kill Locking Processes and Clear Handles on macOS
  • 4 Resolve Server-Side Locks and Check-Out Status
  • 5 Summary Quick Reference Checklist

File Locked Errors

“File Locked” errors occur when a cloud sync client (e.g., OneDrive, SharePoint, Google Drive, or Dropbox) cannot upload or update a file because it is locked by an operating system process or checked out by another user. You may see error codes like “The file is locked by another process” or “Cannot sync: File in use”.

This guide provides steps to identify the applications holding locks on your files, force release those handles, and resolve server-side co-authoring lockouts on both Windows and macOS.


1. Understand File Locking Mechanics in Cloud Storage

A file can be locked in three distinct ways:

  • Local File Handle Lock: A local application (e.g. Word, Excel, Photoshop, or a software compiler) has opened the file and flagged it with an exclusive OS write lock. The cloud client cannot read the file stream.
  • Server-Side Lock (Co-Authoring Lock): A co-worker has opened the file in an editor that places a temporary collaboration lock on the cloud server.
  • Check-Out Lock: The document library (especially in SharePoint or Teams) is configured to require files to be checked out before editing, blocking sync clients from updating the server version.

2. Release File Locks on Windows Using Resource Monitor and PowerShell

Windows prevents files from being modified or read when an open handle exists.

A. Identify and Terminate Locks using Resource Monitor

  1. Press Ctrl + Shift + Esc to open Task Manager.
  2. Go to the Performance tab and click Open Resource Monitor at the bottom.
  3. In Resource Monitor, go to the CPU tab.
  4. Expand the Associated Handles section.
  5. In the Search Handles box, type the name of the locked file.
  6. Right-click the process holding the handle (e.g., winword.exe) and select End Process.

B. Force Handle Release with PowerShell

If the file is locked in an active development directory:

# Identify processes accessing files within a target path
Get-Process | Where-Object {$_.Modules.FileName -like "*your-file-name*"} | Stop-Process -Force

3. Kill Locking Processes and Clear Handles on macOS

On macOS, you can find the application locking your files using the terminal utility lsof and kill it.

A. Locate and Force Close Locked Files via Terminal

  1. Open Terminal (via Spotlight).
  2. Use the lsof command to search for open handles in your cloud directory:
    # Search for open file handles on a specific file
    lsof "/Users/$(whoami)/Library/CloudStorage/OneDrive-Personal/stuck-file.xlsx"
  3. Terminal will output the process name (COMMAND) and process ID (PID). For example:
    COMMAND   PID    USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
    Excel   12450   derek    5u  REG    1,4 10485760 123456 stuck-file.xlsx
  4. Terminate the application using the PID:
    kill -9 12450

B. Clear Hidden System Lockfiles

Sometimes, Microsoft Office or Adobe leaves hidden lock files behind. Clean them out of your sync directories:

# Delete temporary lock files in your CloudStorage directory
find ~/Library/CloudStorage -type f -name "~$*" -delete

4. Resolve Server-Side Locks and Check-Out Status

If local processes are closed but the cloud warns the file is locked by “Another User” or “System”:

A. Cancel Check-Out or Discard Changes (SharePoint / OneDrive)

  1. Go to your cloud storage web interface (e.g. OneDrive/SharePoint online).
  2. Right-click the locked file.
  3. Select Version History or Manage Access.
  4. If the file is Checked Out, click More > Check in or Discard check-out.

B. Wait out the Co-Authoring Lock TTL (Time-To-Live)

If a user closes their Office client abruptly (e.g., network loss, computer crash), the server-side lock remains active.

  • Time-To-Live: Server locks automatically expire after 10 to 15 minutes of inactivity. Avoid modifying the file during this cooling-off period to prevent conflict copies.

5. Summary Quick Reference Checklist

Action TargetOperating SystemTerminal Command / PathExpected Outcome
Search HandleWindowsResource Monitor > CPU > Associated HandlesFinds the process holding the file lock.
Kill ProcessWindowstaskkill /f /im <process.exe>Releases the local OS-level lock on the file.
List Open HandlesmacOSlsof <file-path>Identifies the macOS process ID locking the file.
Force Release PIDmacOSkill -9 <PID>Terminates the locking process instantly.
Clear LockfilesmacOSfind <path> -name "~$*" -deletePurges orphaned Office lockfiles.
Discard Check-outCloud Web ConsoleDocument Library > File OptionsFrees server-side checkout blocks for co-workers.