vercel / vercel/next.js

Using a parallel route slot with dynamic route, in parallel to a catch-all route causes non-turbo dev server and build to fail.

Open
#71,087 4 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug linear: next Module Resolution Parallel & Intercepting Routes
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/ItsWendell/nextjs-14.2.15-catch-all-parallel-routes-dynamic-segments-build-issues-repo

To Reproduce
  • Create a catch-all route
  • Create a parallel route slot somewhere with a dynamic path

Reproduction:

Clone this repository

  1. Run npm install
  2. Run npm run dev --turbo and visit http://localhost:3000/
  3. Press the "Lets visit a blog post that contains a slot with a dynamic parallel route." button, press "Start slotting" to visit a dynamic slot within that blog page / layout
  4. See that it works pretty well, now let's make it fail:
  5. Run npm run build, the build will fail with error: ENOENT: no such file or directory, open '/Projects/parallel-routes-catch-all/.next/server/app/(blog)/blog/[slug]/@info/info/[infoId]/page_client-reference-manifest.js'
  6. Run npm run dev (without turbo) see that it fails as soon as you click the "Start slotting" button with a similar error: ENOENT: no such file or directory, open '/Projects/parallel-routes-catch-all/.next/server/app/(blog)/blog/[slug]/@info/info/[infoId]/page_client-reference-manifest.js'
Current vs. Expected behavior

I expect next build to compile a valid version, since it works sucessfully in next dev --turbo as I expected. So that I can use the parallel routes together with catch-all routes, as next dev --turbo shows, it should have higher priority than the catch-all route.

Provide environment information
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Wed Oct  9 05:26:29 UTC 2024
  Available memory (MB): 31561
  Available CPU cores: 8
Binaries:
  Node: 22.8.0
  npm: 10.8.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.2.15 // Latest available version is detected (14.2.15).
  eslint-config-next: 14.2.15
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.6.3
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Module Resolution, Parallel & Intercepting Routes

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

next dev (local), next build (local), next start (local)

Additional context

I tested against latest canary [15.0.0-canary.182](https://www.npmjs.com/package/next/v/15.0.0-canary.182) too, and the latest stable 14.2.15.

Workaround

I found a work around: Instead of using an required catch-all route I've replaced the catch-all route with a non-optional catch all route [[...slug]] vs [...slug], this seems to continue the build. Not optimal because in some cases you want to have e.g. a seperate page.tsx and a catch-all for all other pages, but we can work around that. This issue is still relevant, since this behavior should be the same with an optional catch all route.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction repository and run the reported npm install, next dev, and next build commands. Compare the working turbo route with the failing non-turbo and build paths, focusing on the missing .next/server/app/(blog)/blog/[slug]/@info/info/[infoId]/page_client-reference-manifest.js. Done means the catch-all and dynamic parallel route combination builds and runs in both dev modes without the ENOENT error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, react
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.