next.js: Could not find the module in the React Client Manifest. This is probably a bug in the React Server Components bundler.

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:19 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8103
    Binaries:
      Node: 16.20.0
      npm: 8.19.4
      Yarn: 1.22.19
      pnpm: 8.6.0
    Relevant Packages:
      next: 13.4.11-canary.0
      eslint-config-next: 13.4.8
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://github.com/vercel/next.js/assets/16620277/58d05257-6176-47bb-bca5-b84afb6c5843

To Reproduce

https://stackblitz.com/github/easydevgit/next-13-course/tree/master/advanced-routing-intercepting-routes?file=app/layout.tsx

Describe the Bug

Screenshot 2023-07-19 at 3 46 47 PM Screenshot 2023-07-19 at 3 54 29 PM

I am getting this error after updating to 13.4.10 and also on latest canary. It is working fine on 13.4.9. I am using parallel and intercepting routes.

Expected Behavior

Normal parallel and intercepting route behaviour.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Vercel

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I believe #52664 is causing the issue. The issue appears to be due to the naming convention of intercepting routes.

Line 352 in packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts

const groupName = entryName
        .slice(0, entryName.lastIndexOf('/'))
        .replace(/\/@[^/]+/g, '')
        .replace(/\/\([^/]+\)/g, '')

If we do a normal group,

const route1 = "app/(group)/@named/foo/page.tsx"

const groupName = route1
        .slice(0, route1.lastIndexOf('/'))
        .replace(/\/@[^/]+/g, '')
        .replace(/\/\([^/]+\)/g, '')

console.log(groupName)
// output: 'app/foo' (correct syntax)

However if we do an intercepting route,

const route2 = "app/(group)/@named/(.)foo/page.tsx"

const groupName = route2
        .slice(0, route2.lastIndexOf('/'))
        .replace(/\/@[^/]+/g, '')
        .replace(/\/\([^/]+\)/g, '')

console.log(groupName)
// output: 'appfoo' <----- Missing '/'

I’m not sure if it handles intercepting routes above or elsewhere, but this just caught my eye at first glance. It would make sense why intercepting routes don’t work.

Hi all, this issue should be fixed in 13.4.11. Please upgrade and let us know, thanks!

Here is a simple way to reproduce this issue:

  1. Clone https://github.com/vercel-labs/nextgram/tree/main
  2. Update to next@latest (13.4.10)
  3. Run

Anytime you click a photo the error will popup.

Error: Could not find the module "X:\gits\testerror\nextgram\src\components\modal\Modal.tsx#" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

I am facing the same problem I made a modal using parallel routing and intercepting route it works fine but when I added a back button using useRouter from “next/navigation” it is giving me error:

Unhandled Runtime Error Error: Could not find the module “[absolute path]\app@modal(.)password\new\page.jsx#” in the React Client Manifest. This is probably a bug in the React Server Components bundler.

Please help me I need to add this back function 🥹

Edited: I check it once again and found out that this error doesn’t occur when I used useRouter but when I added “use client”;

I get this error when nested components both have use client defined. I don’t know whether that is related, but it is perhaps worth noting.

uh oh, .13 broke this again, cc @shuding

Thanks @shuding, it’s fixed!

So did the PR above forget to account for the (.) and (..) characters? And with the (..) paths, it would need to resolve the paths. I tried doing a “(…)(…)(…)” path to see if nextjs would properly walk up the tree but it throws an error. The implementation doesn’t seem robust, since this is probably at least the 5th issue regarding route interception/modals.

@timneutkens please forgive our incompetence 😉 But in the stackblitz above, the model interception of (.)login causes the app to crash when it tries to intercept the route.

@timneutkens @khuezy Opened new issue as earlier one was locked #50243