Skip to content
Latchkey

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.

cmd
error: unable to create file node_modules/.../some/very/deeply/nested/module/index.js:
Filename too long
fatal: cannot create directory at '...': Filename too long

Common 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.

cmd
git config --system core.longpaths true

Enable the OS long-path policy

Set the registry flag so Win32 APIs honor long paths, then ensure your tool opts in too.

powershell
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' `
  -Name 'LongPathsEnabled' -Value 1 -Type DWord

Shorten the workspace path

  1. Check out into a short directory such as C:\w instead of the deep default work path.
  2. 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →