Quick answer
Windows limits a full path to 260 characters. Shorten long file and folder names, or move the folder closer to the top so the whole path fits. For SharePoint, sync a subfolder instead of the entire library.
WHY IT HAPPENS
The whole path counts, not just the file name.
When OneDrive syncs, it lays the files out in a local folder on your PC, and Windows measures the full path — the site or drive, every nested folder name in between, and the file name — all added together. That total can't go past Windows' long-standing 260-character limit. Deeply nested SharePoint libraries with long, descriptive folder names blow past it quickly, and once a path is too long, OneDrive simply can't sync that file.
THE FIX
Work through these in order.
- Shorten the file nameThe quickest win. Rename the file to something shorter — drop dates, repeated words and version notes that push the length up. Every character you remove buys you headroom.
- Shorten long parent folder namesLong, descriptive folder names add up fast. Trim the folders the file sits inside — for example "Client Correspondence 2024–2025 Archive" becomes "Correspondence".
- Move the file higher up the treeDrag the file or folder closer to the top level so there are fewer folders in the path. Fewer nested folders means a shorter total path.
- Sync a subfolder, not the whole libraryIn SharePoint, use Sync (or Add shortcut to OneDrive) on a specific subfolder rather than the entire library. This shortens the local path prefix on your PC and can bring long paths back under the limit.
- Rename via the web if you can't reach it locallyIf the file won't sync at all, open OneDrive or SharePoint in your browser and rename or reorganise it there. The change syncs back down once the path is short enough.
- (IT) Enable Win32 long pathsIT can enable long-path support via Group Policy or the registry (the LongPathsEnabled setting). Note that not every application respects it, so it's not a complete fix on its own — shortening names is still the reliable approach.
- Flatten deep folder structuresIf the same folders keep hitting the limit, the structure itself is too deep. Rework it into fewer, broader levels so paths stay comfortably under 260 characters going forward.
If this keeps happening across the team, it's a SharePoint structure problem rather than a one-off file. A short review of folder depth and naming conventions ends it for good — IT can help you redesign the library so paths stay short and nobody hits this again.