Repository navigation
Conversation
Co-authored-by: Copilot <[email protected]>
asxxb
force-pushed
the
fix/watchpack-eperm-initial-scan
branch
from
October 17, 2026 19:21
56540e3 to
56b79ae
Compare
Contributor
Failing CI jobsCommit: 56b79ae | About building and testing Next.js |
|
@asxxb LGTM |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Fixes Next.js development route discovery when Watchpack encounters
EPERMduring its initial directory scan.When the initial scan fails for a route directory, Watchpack can treat the directory as removed, omit valid page files from its known files, and fail to emit a subsequent aggregation. This can leave the development server waiting for the initial scan deadline and affected routes unavailable.
Fixes #100268
Why?
The existing initial-scan protection prevents Next.js from publishing an incomplete route graph while Watchpack is performing its initial scan.
However, when Watchpack encounters
EPERM, it may not emit another aggregation to reevaluate the initial-scan guard. This can delay route discovery until the fallback deadline.The fix preserves the existing startup-race protection while allowing valid page files from the initial filesystem snapshot to be recovered when Watchpack fails to report them.
How?
EPERMduring a nested Pages Router directory scan and verifies route availability across subsequent aggregations.The recovery is limited to valid page files captured in the initial filesystem snapshot. It does not attempt to recreate Watchpack's failed directory watcher.
Testing
Build and static checks
pnpm --filter=next buildpnpm --filter=next typescriptpnpm types:test-libpnpm --filter=next typespnpm lint-ast-grepgit diff --checkEnd-to-end tests
next/headdevelopment route-discovery test file: Webpack 7/7 passed; Turbopack 7/7 passed.next/headproduction/start tests: Turbopack 5/5 passed.A repeated test run encountered an intermittent
Invalid hook call/useContextfailure involvingstyled-jsxandreact-dom-server.edgein an unrelated test. The Watchpack EPERM regression test passed where reached.git diff --checkcompleted successfully.Scope and limitation
This change restores routes from the pre-watch filesystem snapshot and ensures they remain available across subsequent aggregations. It does not guarantee that Watchpack resumes detecting future file changes inside a directory whose initial scan failed with
EPERM.