nextjs - ✅(Solved) Fix TurbopackInternalError when outputFileTracingRoot path is invalid [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#87881Fetched 2026-04-08 02:05:55
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
commented ×2labeled ×2cross-referenced ×1issue_type_added ×1

Error Message

FATAL: An unexpected Turbopack error occurred. A panic log has been written to /tmp/next-panic-da8431fdb961198c2c41186f79b7b442.log.

To help make Turbopack better, report this error by clicking here: https://github.com/vercel/next.js/discussions/new?category=turbopack-error-report&title=Turbopack%20Error%3A%20Invalid%20distDirRoot%3A%20%22.next%22.%20distDirRoot%20should%20not%20navigate%20out%20of%20the%20projectPath.&body=Turbopack%20version%3A%20%60d1bd5b58%60%0ANext.js%20version%3A%20%600.0.0%60%0A%0AError%20message%3A%0A%60%60%60%0ATurbopack%20Error%3A%20Invalid%20distDirRoot%3A%20%22.next%22.%20distDirRoot%20should%20not%20navigate%20out%20of%20the%20projectPath.%0A%60%60%60&labels=Turbopack,Turbopack%20Panic%20Backtrace

Error [TurbopackInternalError]: Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath.

Debug info:

  • Execution of Project::project_fs failed
  • Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath. at <unknown> (TurbopackInternalError: Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath.) { location: undefined }

Fix Action

Fixed

PR fix notes

PR #87883: Add path validation check to ouputFileTracingRoot, turbopack.root

Description (problem / solution / changelog)

What?

Fix TurbopackInternalError on build due to misconfiguration of project root directory via outputFileTracingRoot or turbopack.root. Due to the straightforward nature of the error, a helpful link was not included.

Why?

See #87881

How?

Adding a check to assignDefaultsAndValidate that both values exist and are directories.

Closes NEXT- Fixes #87881

Tests

Added a test to config.test.ts. The existing implementation had two unit tests with fake paths that were now failing - these were updated to use real paths.

Changed files

  • packages/next/errors.json (modified, +5/-1)
  • packages/next/src/server/config.ts (modified, +40/-14)
  • test/unit/isolated/config.test.ts (modified, +43/-14)

Code Example

npm i
npm run build

---

FATAL: An unexpected Turbopack error occurred. A panic log has been written to /tmp/next-panic-da8431fdb961198c2c41186f79b7b442.log.

To help make Turbopack better, report this error by clicking here: https://github.com/vercel/next.js/discussions/new?category=turbopack-error-report&title=Turbopack%20Error%3A%20Invalid%20distDirRoot%3A%20%22.next%22.%20distDirRoot%20should%20not%20navigate%20out%20of%20the%20projectPath.&body=Turbopack%20version%3A%20%60d1bd5b58%60%0ANext.js%20version%3A%20%600.0.0%60%0A%0AError%20message%3A%0A%60%60%60%0ATurbopack%20Error%3A%20Invalid%20distDirRoot%3A%20%22.next%22.%20distDirRoot%20should%20not%20navigate%20out%20of%20the%20projectPath.%0A%60%60%60&labels=Turbopack,Turbopack%20Panic%20Backtrace
-----

Error [TurbopackInternalError]: Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath.

Debug info:
- Execution of Project::project_fs failed
- Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath.
    at <unknown> (TurbopackInternalError: Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath.) {
  location: undefined
}

---

Operating System:
  Platform: linux
  Arch: x64
  Version: #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025
  Available memory (MB): 64031
  Available CPU cores: 20
Binaries:
  Node: 22.13.0
  npm: 11.4.1
  Yarn: 1.22.22
  pnpm: 9.6.0
Relevant Packages:
  next: 16.1.1 // Latest available version is detected (16.1.1).
  eslint-config-next: 15.1.6
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.8.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/Daves1245/nextjs-config-issue-example

To Reproduce

npm i
npm run build

Current vs. Expected behavior

Expected: A clear error should mention the outputFileTracingRoot configuration issue. Actual: Turbopack panics with an internal error.

FATAL: An unexpected Turbopack error occurred. A panic log has been written to /tmp/next-panic-da8431fdb961198c2c41186f79b7b442.log.

To help make Turbopack better, report this error by clicking here: https://github.com/vercel/next.js/discussions/new?category=turbopack-error-report&title=Turbopack%20Error%3A%20Invalid%20distDirRoot%3A%20%22.next%22.%20distDirRoot%20should%20not%20navigate%20out%20of%20the%20projectPath.&body=Turbopack%20version%3A%20%60d1bd5b58%60%0ANext.js%20version%3A%20%600.0.0%60%0A%0AError%20message%3A%0A%60%60%60%0ATurbopack%20Error%3A%20Invalid%20distDirRoot%3A%20%22.next%22.%20distDirRoot%20should%20not%20navigate%20out%20of%20the%20projectPath.%0A%60%60%60&labels=Turbopack,Turbopack%20Panic%20Backtrace
-----

Error [TurbopackInternalError]: Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath.

Debug info:
- Execution of Project::project_fs failed
- Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath.
    at <unknown> (TurbopackInternalError: Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath.) {
  location: undefined
}

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025
  Available memory (MB): 64031
  Available CPU cores: 20
Binaries:
  Node: 22.13.0
  npm: 11.4.1
  Yarn: 1.22.22
  pnpm: 9.6.0
Relevant Packages:
  next: 16.1.1 // Latest available version is detected (16.1.1).
  eslint-config-next: 15.1.6
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.8.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack, Error Handling

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

extent analysis

TL;DR

The issue can be resolved by configuring the distDir option in the Next.js configuration to a valid directory that does not navigate out of the project path.

Guidance

  • Verify the next.config.js file for any custom configurations that might be causing the distDirRoot to be set to .next, which is not a valid directory.
  • Check the project structure to ensure that the .next directory is not being used as a build output directory.
  • Update the next.config.js file to include a valid distDir option, such as distDir: 'build', to specify the build output directory.
  • Run npm run build again to test if the issue is resolved.

Example

No code example is provided as the issue is related to configuration and not a specific code snippet.

Notes

The issue seems to be related to the distDirRoot configuration in Turbopack, which is used by Next.js. The error message indicates that the .next directory is not a valid build output directory. The solution involves updating the next.config.js file to specify a valid build output directory.

Recommendation

Apply workaround: Update the next.config.js file to include a valid distDir option, such as distDir: 'build', to specify the build output directory. This should resolve the issue with Turbopack panicking due to an internal error.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix TurbopackInternalError when outputFileTracingRoot path is invalid [1 pull requests, 2 comments, 2 participants]