next dev: a healthy page answers 500 with another page's compile error once that page was requested (Turbopack and webpack)
Link to the code that reproduces this issue
https://github.com/blackdiamond6390/next-cross-page-error-repro
To Reproduce
npm installnpm run dev(Turbopack).npm run dev:webpackshows the same with webpack.- Request
/ok: it answers 200.curl -s -o /dev/null -w '%{http_code}\n' http://localhost:3000/ok - Request
/broken, a page that imports a module that does not exist: it answers 500, as expected.curl -s -o /dev/null -w '%{http_code}\n' http://localhost:3000/broken - Request
/okagain.curl -s -o /dev/null -w '%{http_code}\n' http://localhost:3000/ok
Current vs. Expected behavior
Current: in step 5, /ok answers 500. Its body and the error overlay show
Module not found: Can't resolve './does-not-exist', which is the error of app/broken/page.js.
/ok itself has no error. It stays that way: 60 seconds later /ok still answers 500. Same result
with next dev (Turbopack) and next dev --webpack.
Expected: /ok keeps answering 200, and only /broken answers 500 with its own error. Errors that
concern every route (top-level issues, middleware, instrumentation, _app, _document) would
still be shown on every route.
Why it matters: in a project where several people or tools edit files at the same time, one half-written page that somebody opens in the browser makes every other page of the dev server answer 500 for everyone, until that page compiles again.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Tue Oct 27 00:24:11 UTC 2026
Available memory (MB): 40110
Available CPU cores: 20
Binaries:
Node: 26.13.1
npm: 11.20.0
Yarn: N/A
pnpm: 12.16.1
Relevant Packages:
next: 16.5.0-canary.72 // Latest available version is detected (16.5.0-canary.72).
eslint-config-next: N/A
react: 19.3.1
react-dom: 19.3.1
typescript: N/A
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Turbopack, Webpack, Error Overlay
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
Also reproduced with [email protected]. The code below is the same in 16.5.0-rc.0 and on canary.
Turbopack: getCompilationErrors(page) in packages/next/src/server/dev/hot-reloader-turbopack.ts
returns the issues of the requested entry when it has any. When it has none, it falls through to
the branch commented // Otherwise, return all errors across pages and returns the errors of every
entry in currentEntryIssues, so the requested page gets the error of another page.
Restricting that fallback to the top-level issues and to the entries that apply to every request
fixed it in the reproduction on 16.4.6, where I patched the compiled file (/ok stayed at 200
after /broken, and 80 seconds later); I have not built canary with it:
// Otherwise, only the errors that concern every page
const errors = []
for (const issue of topLevelIssues) {
if (issue.severity !== 'warning') {
errors.push(new Error(formatIssue(issue)))
}
}
for (const [entryKey, entryIssues] of currentEntryIssues) {
const { type, page: entryPage } = splitEntryKey(entryKey)
const concernsEveryPage =
type === 'root' ||
(type === 'pages' &&
(entryPage === '_app' || entryPage === '_document' || entryPage === '_error'))
if (!concernsEveryPage) continue
for (const issue of entryIssues.values()) {
if (issue.severity !== 'warning') {
errors.push(new Error(formatIssue(issue)))
} else {
printNonFatalIssue(issue)
}
}
}
return errors
webpack: getCompilationErrors(page) in packages/next/src/server/dev/hot-reloader-webpack.ts
returns failedPages[normalizedPage] when the page has errors and compilation.errors (all of them)
otherwise. erroredPages() maps errors to pages with getRouteFromEntrypoint(name) without the
app flag, so errors of App Router entries are never mapped to a page and every page gets all
of them. Passing the app flag alone did not change the result in the reproduction, so the mapping
of App Router errors to their entry seems to fail before that as well. I have not found a fix for
the webpack side.