How to fix Error 387 on Windows 11

Windows 11 Troubleshooting Guide: Cloud Sync Error 387

Why This Error Happens

Error 387 occurs when the Cloud Files API (CldApi.dll), which manages sync providers like OneDrive, cannot allocate sufficient memory, handles, or disk cache to complete a file operation. This typically results from excessive open file handles, a bloated placeholder database in the sync cache, or insufficient available RAM/virtual memory caused by other resource-heavy background processes. Corrupted sync metadata in the local %LocalAppData% cache can also trigger this error by forcing the sync engine to retry operations repeatedly, exhausting available resources.

Step-by-Step Resolution Guide

  1. Increase Virtual Memory (Paging File) Size
    Go to Settings > System > About > Advanced system settings > Performance Settings > Advanced tab > Virtual Memory > Change. Uncheck “Automatically manage paging file size,” select your system drive (usually C:), choose Custom size, and set Initial size to 1.5x your RAM (in MB) and Maximum size to 3x your RAM. Click Set, then OK, and restart.

  2. Reset the Sync Provider Cache
    Close the sync client (e.g., OneDrive) via Task Manager. Navigate to %LocalAppData%\Microsoft\OneDrive\settings and rename the folder containing your account GUID to .old. Restart the sync app to force it to rebuild a fresh cache.

  3. Run the OneDrive Reset Command
    Press Win + R, type:

   %localappdata%\Microsoft\OneDrive\onedrive.exe /reset

Press Enter, wait 1–2 minutes, then manually relaunch OneDrive from the Start menu.

  1. Check for Handle Leaks via Resource Monitor
    Open Resource Monitor (type resmon in Start), go to the CPU tab, and check the Handles section for the sync process (e.g., OneDrive.exe). If handle counts exceed several thousand and keep climbing, restart the process and update the client to the latest version via Settings > Windows Update.

  2. Free Up System Resources
    Open Task Manager (Ctrl+Shift+Esc) > Startup apps tab and disable non-essential startup programs competing for RAM/CPU during sync operations. Also verify at least 15–20% free space remains on your system drive via This PC.

Alternative or Verification Steps

  • Verify the fix: Open Event Viewer (eventvwr.msc), navigate to Windows Logs > Application, and confirm no new Error 387 entries appear after triggering a manual sync (right-click the sync icon in the system tray > Sync now).
  • Alternative fix: If the error persists, fully unlink and re-link your cloud account (Settings > Account > Unlink this PC), then sign back in to force a clean resync with a fresh local database.