Windows "Filename too long" / MAX_PATH (260 chars) in CI
A file path exceeded the legacy Windows MAX_PATH limit of 260 characters. Deeply nested node_modules, long branch-named workspaces, or generated paths blow past it and the operation fails.
What this error means
git, npm, or a build tool aborts with "Filename too long" or a path-length error. It is deterministic for a given repo layout: the same long path fails every time until the limit is lifted or the path shortened.
error: unable to create file node_modules/.../some/very/deeply/nested/module/index.js:
Filename too long
fatal: cannot create directory at '...': Filename too longCommon causes
MAX_PATH is still enforced
Many Windows APIs and tools cap paths at 260 characters unless long-path support is explicitly enabled in both the OS and the tool.
The workspace root is already long
Runner working directories nest the repo name twice; a long org/repo plus deep dependencies easily crosses the limit before your own files even start.
How to fix it
Enable long paths for git
Turn on git long-path support so checkout can write paths beyond 260 characters.
git config --system core.longpaths trueEnable the OS long-path policy
Set the registry flag so Win32 APIs honor long paths, then ensure your tool opts in too.
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' `
-Name 'LongPathsEnabled' -Value 1 -Type DWordShorten the workspace path
- Check out into a short directory such as C:\w instead of the deep default work path.
- For Node, hoist dependencies or use a flatter package manager layout to reduce nesting.
How to prevent it
- Enable core.longpaths and the LongPathsEnabled policy on the image, and keep the checkout directory short to leave headroom under 260 characters.