nextjs - 💡(How to fix) Fix Turbopack build: NFT warning "unexpected file" / next.config in trace with server routes reading fs outside app/ (outputFileTracingRoot) [1 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#92639Fetched 2026-04-11 06:08:14
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
closed ×1commented ×1labeled ×1locked ×1

During next build (Turbopack, Next.js 16.2.x), the build succeeds but prints:

Encountered unexpected file in NFT list for ./app/next.config.ts, with an import trace such as:

next.config.tssrc/lib/records.tssrc/app/api/records/route.ts

The message suggests "whole project traced unintentionally" and mentions path.join / fs.readFile.

Root Cause

During next build (Turbopack, Next.js 16.2.x), the build succeeds but prints:

Encountered unexpected file in NFT list for ./app/next.config.ts, with an import trace such as:

next.config.tssrc/lib/records.tssrc/app/api/records/route.ts

The message suggests "whole project traced unintentionally" and mentions path.join / fs.readFile.

RAW_BUFFERClick to expand / collapse

Description

During next build (Turbopack, Next.js 16.2.x), the build succeeds but prints:

Encountered unexpected file in NFT list for ./app/next.config.ts, with an import trace such as:

next.config.tssrc/lib/records.tssrc/app/api/records/route.ts

The message suggests "whole project traced unintentionally" and mentions path.join / fs.readFile.

Setup (minimal shape)

  • Monorepo or repo layout where the Next app lives in app/ and shared content (e.g. markdown DB) lives next to app/ at the repo root, e.g. knowledge-base/app/ and knowledge-base/db/**/*.md.
  • next.config.ts under app/ sets:
    • outputFileTracingRoot: path.join(__dirname, '..') (parent = repo root that contains db/)
    • outputFileTracingIncludes with globs like db/**/*.md relative to that root.
  • Server-only code uses fs + path.join(process.cwd(), '..', 'db', ...) (with turbopackIgnore on process.cwd() where applicable) to read markdown at runtime.

Actual behavior

Warning appears every production build. It does not fail the build.

Expected / question

  • Is this warning safe to ignore when outputFileTracingIncludes and deploy traces are correct?
  • Or should Turbopack stop associating next.config with route modules in this graph, or downgrade the diagnostic when outputFileTracingRoot intentionally points outside app/?

What we tried (still warns or worse)

  • /* turbopackIgnore: true */ on __dirname in path.join for outputFileTracingRoot — warning remains.
  • next build --webpack — warning gone, but NFT manifests did not list db/**/*.md the same way; deployment trace checks failed.
  • turbopack.root — not used; known to cause other resolution issues in monorepos (see existing discussions).

Environment

  • Next.js: 16.2.2
  • Node: 22.x (example)
  • OS: Windows / Linux (repro on Windows with repo under Dropbox path)

Reference

Public repo for full layout (if maintainers want a real tree): https://github.com/alawein/knowledge-base — build: cd app && npm run build; post-build NFT check: npm run verify:nft in app/.

extent analysis

TL;DR

The warning "Encountered unexpected file in NFT list" during next build with Turbopack in Next.js

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 - 💡(How to fix) Fix Turbopack build: NFT warning "unexpected file" / next.config in trace with server routes reading fs outside app/ (outputFileTracingRoot) [1 comments, 2 participants]