After upgrading to Next.js 16.0.1, the build fails during prerendering of the internal /_not-found route with the following error:
Open
Nobody has claimed this yet.
linear: next
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.5k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/md2docx/mdast2docx/tree/a9078b882ec58f3cdafb68446c8d0c679a1907b8/examples/nextjs
To Reproduce
- clone repo and install dependencies
- run build command
Current vs. Expected behavior
Current:
Build fails with following error:
Error occurred prerendering page "/_not-found".
Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
{linkComponent: function i}
^^^^^^^^^^
Export encountered an error on /_not-found/page: /_not-found, exiting the build.
Expected: should build without errors as with next.js 15
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home Single Language
Available memory (MB): 16168
Available CPU cores: 8
Binaries:
Node: 22.19.0
npm: 10.9.3
Yarn: 1.22.19
pnpm: 10.20.0
Relevant Packages:
next: 16.0.1 // Latest available version is detected (16.0.1).
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/A
Done in 3.06s.
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked md2docx examples/nextjs reproduction, install dependencies, and run its build command under Next.js 16.0.1. Compare the failing /_not-found prerender with Next.js 15; done means the reproduction builds without the reported function-passing error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, react, typescript
- Domain
- build-system, frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100