nextjs - ✅(Solved) Fix Turbopack HMR - Error: Could not find the module X in the React Client Manifest [13 pull requests, 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#85883Fetched 2026-04-08 02:13:29
View on GitHub
Comments
1
Participants
2
Timeline
31
Reactions
48
Author
Timeline (top)
subscribed ×16cross-referenced ×4referenced ×4labeled ×3

Error Message

⨯ Error: Could not find the module "[project]/src/Component.tsx#Component" in the React Client Manifest. This is probably a bug in the React Server Components bundler. at stringify (<anonymous>) { digest: '3482605753' }

Fix Action

Fixed

PR fix notes

PR #14502: fix: potential error spam during hmr, when using next.js 16 and turbopack

Description (problem / solution / changelog)

Fixes https://github.com/payloadcms/payload/issues/14419.

In a live-preview enabled page, both the admin panel and the frontend initialize their own getPayload instances, each subscribing to HMR updates. In Next.js 16 with Turbopack, this setup can cause the server console to be flooded with errors like:

Error: Could not find the module "[project]/node_modules/.pnpm/[path-to-importmap-entry]" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

These errors occur when an fs call tries to access the import map during the reload process.

Fix

The import map generation is now deferred using setTimeout and is no longer awaited. This prevents the problematic awaited fs access during HMR reloads.

Video that showcases this issue and the solution on the website template:

https://github.com/user-attachments/assets/afd5e6cf-09ac-4cda-bbdc-88dc4d1e7108

Additional Improvements

Additionally, this PR prevents multiple reload operations from overlapping by skipping new reloads while one is already in progress.

This reduces redundant reload triggers when multiple getPayload instances are subscribed to the same HMR websocket, reducing the chance of something going wrong.

Changed files

  • packages/payload/src/index.ts (modified, +28/-11)

PR #14456: feat: next.js 16 support

Description (problem / solution / changelog)

This PR:

  • updates this monorepo to use Next.js 16. Running our test suites against Next.js 16 is required to guarantee support.
  • updates all peerDependencies to support the latest Next.js canary.

Individual Next.js 16–related fixes were made in separate, smaller PRs (listed below). As a result, the majority of the changes in this PR are focused on getting the test suite to pass.

Templates will be updated in a separate PR once Next.js 16.2.0 is released.

Current Status / Known Issues

You can use Next.js 16 with Payload, as long as you're using the latest Payload version and Next.js >16.1.1-canary.35 or, if released, 16.2.0.

List of Next.js 16-related PRs that were extracted from this branch

List of Next.js / React issues that were fixed - no longer blockers

  • Turbopack HMR stability - vercel/next.js#85883 Currently breaks when a live-preview–enabled page is open (related Payload issue). The Next.js team is actively working on a fix: PR #86239. Fixed in Next.js canary
  • Turbopack Build support: PR #86375. Fixed in Next.js canary
  • We need to wait for vercel/next.js#84029 to be resolved. We initially expected these hydration errors to be suppressible, but that turned out not to be the case. As a result, this issue is now the final blocker for Next.js 16 support. Most of the CI e2e test failures in this PR are the result of this issue.

Changed files

  • docs/performance/overview.mdx (modified, +2/-4)
  • next-env.d.ts (modified, +1/-0)
  • next.config.mjs (modified, +6/-4)
  • package.json (modified, +7/-6)
  • packages/admin-bar/package.json (modified, +2/-2)
  • packages/db-d1-sqlite/bundle.js (modified, +2/-0)
  • packages/db-postgres/bundle.js (modified, +2/-0)
  • packages/db-postgres/package.json (modified, +1/-1)
  • packages/db-sqlite/bundle.js (modified, +2/-0)
  • packages/db-vercel-postgres/package.json (modified, +1/-1)
  • packages/live-preview-react/package.json (modified, +2/-2)
  • packages/next/bundle.js (modified, +2/-0)
  • packages/next/package.json (modified, +5/-5)
  • packages/next/src/withPayload/withPayload.js (modified, +36/-0)
  • packages/payload/bundle.js (modified, +4/-0)
  • packages/payload/package.json (modified, +1/-1)
  • packages/payload/src/index.ts (modified, +9/-0)
  • packages/plugin-cloud-storage/package.json (modified, +2/-2)
  • packages/plugin-ecommerce/package.json (modified, +2/-2)
  • packages/plugin-form-builder/package.json (modified, +2/-2)
  • packages/plugin-search/package.json (modified, +2/-2)
  • packages/plugin-sentry/package.json (modified, +2/-2)
  • packages/plugin-seo/package.json (modified, +2/-2)
  • packages/plugin-stripe/package.json (modified, +2/-2)
  • packages/richtext-lexical/bundle.js (modified, +2/-1)
  • packages/richtext-lexical/package.json (modified, +3/-3)
  • packages/richtext-lexical/src/exports/server/ast/mdx.ts (modified, +0/-1)
  • packages/richtext-lexical/src/packages/@lexical/markdown/MarkdownImport.ts (modified, +0/-1)
  • packages/richtext-slate/package.json (modified, +2/-2)
  • packages/storage-s3/src/generateSignedURL.ts (modified, +1/-2)
  • packages/storage-s3/src/staticHandler.ts (modified, +0/-1)
  • packages/translations/package.json (modified, +2/-2)
  • packages/ui/bundle.js (modified, +4/-0)
  • packages/ui/package.json (modified, +4/-4)
  • packages/ui/src/elements/DraggableSortable/index.tsx (modified, +10/-4)
  • packages/ui/src/fields/Array/ArrayRow.tsx (modified, +4/-1)
  • packages/ui/src/forms/Form/index.tsx (modified, +6/-0)
  • packages/ui/src/providers/LivePreview/index.tsx (modified, +9/-2)
  • packages/ui/src/providers/Root/index.tsx (modified, +1/-0)
  • packages/ui/src/views/Edit/index.tsx (modified, +20/-0)
  • pnpm-lock.yaml (modified, +6807/-7931)
  • test/access-control/e2e.spec.ts (modified, +8/-9)
  • test/access-control/payload-types.ts (modified, +11/-11)
  • test/access-control/shared.ts (modified, +1/-1)
  • test/admin/e2e/list-view/e2e.spec.ts (modified, +6/-0)
  • test/auth/e2e.spec.ts (modified, +1/-0)
  • test/bulk-edit/config.ts (modified, +5/-16)
  • test/bulk-edit/e2e.spec.ts (modified, +92/-28)
  • test/bulk-edit/seed.ts (added, +21/-0)
  • test/dev.ts (modified, +0/-1)
  • test/docker-compose.yml (modified, +1/-1)
  • test/field-error-states/e2e.spec.ts (modified, +3/-7)
  • test/fields-relationship/e2e.spec.ts (modified, +0/-1)
  • test/fields/collections/Blocks/e2e.spec.ts (modified, +1/-3)
  • test/fields/collections/Date/e2e.spec.ts (modified, +10/-6)
  • test/fields/collections/Indexed/e2e.spec.ts (modified, +0/-1)
  • test/fields/collections/JSON/e2e.spec.ts (modified, +11/-16)
  • test/fields/collections/Tabs/e2e.spec.ts (modified, +7/-9)
  • test/folders/e2e.spec.ts (modified, +3/-4)
  • test/form-state/e2e.spec.ts (modified, +104/-50)
  • test/group-by/e2e.spec.ts (modified, +30/-8)
  • test/helpers.ts (modified, +41/-0)
  • test/helpers/assertToastErrors.ts (modified, +3/-10)
  • test/helpers/e2e/copyPasteField.ts (modified, +3/-0)
  • test/helpers/e2e/groupBy/addGroupBy.ts (modified, +1/-0)
  • test/helpers/e2e/navigateToDoc.ts (modified, +5/-1)
  • test/helpers/e2e/sort/moveRow.ts (modified, +3/-0)
  • test/helpers/e2e/waitForAutoSaveToRunAndComplete.ts (modified, +3/-0)
  • test/helpers/folders/createFolderDoc.ts (modified, +2/-0)
  • test/helpers/sdk/types.ts (modified, +1/-0)
  • test/i18n/e2e.spec.ts (modified, +2/-0)
  • test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts (modified, +9/-6)
  • test/lexical/collections/Lexical/e2e/main/e2e.spec.ts (modified, +6/-0)
  • test/localization/config.ts (modified, +0/-12)
  • test/localization/e2e.spec.ts (modified, +19/-9)
  • test/locked-documents/e2e.spec.ts (modified, +42/-215)
  • test/next.config.mjs (modified, +1/-3)
  • test/package.json (modified, +6/-6)
  • test/plugin-import-export/e2e.spec.ts (modified, +0/-6)
  • test/plugin-multi-tenant/config.ts (modified, +6/-1)
  • test/plugin-multi-tenant/e2e.spec.ts (modified, +18/-10)
  • test/plugin-multi-tenant/seed/index.ts (modified, +2/-23)
  • test/uploads/e2e.spec.ts (modified, +0/-3)
  • test/versions/e2e.spec.ts (modified, +9/-1)

PR #86239: Turbopack: race condition when rendering two RSC at the same time

Description (problem / solution / changelog)

Related to and closes #85883

Changed files

  • test/development/app-dir/hmr-iframe/app/page1/Component.tsx (added, +5/-0)
  • test/development/app-dir/hmr-iframe/app/page1/page.tsx (added, +18/-0)
  • test/development/app-dir/hmr-iframe/app/page1/subscribeToHMR.ts (added, +55/-0)
  • test/development/app-dir/hmr-iframe/app/page2/page.tsx (added, +13/-0)
  • test/development/app-dir/hmr-iframe/hmr-iframe.test.ts (added, +35/-0)
  • test/development/app-dir/hmr-iframe/next.config.js (added, +5/-0)

PR #86591: Handle cross-page client reference contamination in development

Description (problem / solution / changelog)

In development, React is tracking I/O for debugging purposes. Under some circumstances it can happen that I/O that is cached in a global variable (generally not recommended!) might be triggered by a component of one page (the owner of that I/O) and also be emitted as I/O debug info for a component of another page that depends on it. If the owner references client components in its props, those couldn't be serialized for the other page because they don't exist in the client reference manifest of that page, leading to the following error:

Error: Could not find the module "<ID>" in the React Client Manifest.
This is probably a bug in the React Server Components bundler.

To support that case, we're now looking for client references in manifests of other pages, but only in development mode.

A better fix might be to pass a joint debugBundlerConfig option to React, alongside the normal bundlerConfig option, or something like that. But for now, this should suffice.

Another option we considered but disregarded is a change in React to ignore missing client references when emitting them as debug info, and emitting an omission placeholder instead. But for the general case this would mask real bugs in the RSC bundler.

As part of this fix, we're removing the clientReferenceManifest and serverActionsManifest properties from the renderOpts. This is unnecessary because they can be consumed directly from the global manifests singleton.

The proxy pattern introduced here follows a similar approach we were already using in createServerModuleMap.

fixes #85883 closes #86239 closes NAR-524

Changed files

  • packages/next/errors.json (modified, +5/-1)
  • packages/next/src/build/templates/app-page.ts (modified, +2/-8)
  • packages/next/src/build/templates/app-route.ts (modified, +2/-6)
  • packages/next/src/build/templates/edge-app-route.ts (modified, +2/-6)
  • packages/next/src/build/templates/edge-ssr-app.ts (modified, +2/-10)
  • packages/next/src/build/webpack/loaders/next-app-loader/index.ts (modified, +8/-1)
  • packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts (modified, +1/-1)
  • packages/next/src/export/index.ts (modified, +0/-5)
  • packages/next/src/server/app-render/action-handler.ts (modified, +6/-19)
  • packages/next/src/server/app-render/action-utils.ts (modified, +13/-6)
  • packages/next/src/server/app-render/app-render.tsx (modified, +48/-126)
  • packages/next/src/server/app-render/create-component-styles-and-scripts.tsx (modified, +0/-1)
  • packages/next/src/server/app-render/encryption-utils.ts (modified, +3/-154)
  • packages/next/src/server/app-render/encryption.ts (modified, +6/-4)
  • packages/next/src/server/app-render/get-css-inlined-link-tags.tsx (modified, +9/-15)
  • packages/next/src/server/app-render/get-layer-assets.tsx (modified, +0/-1)
  • packages/next/src/server/app-render/manifests-singleton.ts (added, +230/-0)
  • packages/next/src/server/app-render/types.ts (modified, +0/-2)
  • packages/next/src/server/app-render/use-flight-response.tsx (modified, +8/-11)
  • packages/next/src/server/app-render/walk-tree-with-flight-router-state.tsx (modified, +0/-1)
  • packages/next/src/server/load-components.ts (modified, +2/-10)
  • packages/next/src/server/load-default-error-components.ts (modified, +0/-3)
  • packages/next/src/server/use-cache/use-cache-wrapper.ts (modified, +8/-8)
  • packages/next/types/$$compiled.internal.d.ts (modified, +3/-3)
  • packages/react-refresh-utils/ReactRefreshWebpackPlugin.ts (modified, +7/-0)
  • test/development/app-dir/hmr-iframe/app/layout.tsx (added, +5/-0)
  • test/development/app-dir/hmr-iframe/app/page1/Component.tsx (added, +5/-0)
  • test/development/app-dir/hmr-iframe/app/page1/page.tsx (added, +22/-0)
  • test/development/app-dir/hmr-iframe/app/page1/subscribeToHMR.ts (added, +47/-0)
  • test/development/app-dir/hmr-iframe/app/page2/page.tsx (added, +13/-0)
  • test/development/app-dir/hmr-iframe/hmr-iframe.test.ts (added, +38/-0)

Code Example

Error: Could not find the module "[project]/src/Component.tsx#Component" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
    at stringify (<anonymous>) {
  digest: '3482605753'
}

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:34:05 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 16
Binaries:
  Node: 24.0.1
  npm: 10.9.0
  Yarn: 1.22.22
  pnpm: 10.11.0
Relevant Packages:
  next: 16.0.2-canary.9 // Latest available version is detected (16.0.2-canary.9).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.7.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/AlessioGr/next-16-repro

To Reproduce

  1. clone https://github.com/AlessioGr/next-16-repro
  2. pnpm i
  3. pnpm dev
  4. open http://localhost:3000/page1
  5. go to src/app/page2/page.tsx and type. This will trigger HMR
  6. keep triggering HMR until you get the error

Current vs. Expected behavior

In Payload CMS, we listen to the HMR websocket in order to reload the payload config when changes happen.

After upgrading from Next.js 15.4.x → 16 (and starting in 15.5.0), HMR in dev frequently fails with:

 ⨯ Error: Could not find the module "[project]/src/Component.tsx#Component" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
    at stringify (<anonymous>) {
  digest: '3482605753'
}

Affected setup

All of the following tend to be present when the issue reproduces:

  • Build tool: Turbopack (does not reproduce with Webpack / --no-turbo)
  • Next.js: 16.0.x (also 15.5.x)
  • A 'use client' component passed from a (non-async) page (page1) into an RSC
  • The page renders an <iframe> that loads another page (page2)
  • Both page1 and page2 have HMR listeners
  • page1 is open. Due to the iframe, this means that both hmr listeners are actively running at the same time
  • The HMR listener performs an async action on its subsequent invocation after HMR fires

In our case (Payload CMS live preview) the admin and frontend each create their own HMR subscriptions. When both are active, HMR frequently floods the server console with the manifest error above.

The problem began in Next.js 15.5.0 and persists in 16.0.x.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:34:05 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 16
Binaries:
  Node: 24.0.1
  npm: 10.9.0
  Yarn: 1.22.22
  pnpm: 10.11.0
Relevant Packages:
  next: 16.0.2-canary.9 // Latest available version is detected (16.0.2-canary.9).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.7.3
Next.js Config:
  output: N/A

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

Turbopack

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

next dev (local)

Additional context

Original issue report in Payload with analysis: https://github.com/payloadcms/payload/issues/14419

First attempt to fix it from our side: https://github.com/payloadcms/payload/pull/14502

extent analysis

TL;DR

  • The issue can be mitigated by avoiding the simultaneous use of Hot Module Replacement (HMR) listeners in both the parent page and the iframe, potentially by implementing a mechanism to handle HMR updates sequentially.

Guidance

  • Investigate the HMR listener implementation to ensure it can handle concurrent updates from both the parent page and the iframe without flooding the server console with manifest errors.
  • Consider implementing a locking mechanism or a queue to process HMR updates sequentially, preventing the simultaneous invocation of HMR listeners.
  • Review the React Server Components (RSC) bundler configuration to ensure it is correctly set up to handle the specific use case of passing a 'use client' component from a non-async page into an RSC.
  • Verify that the issue is indeed related to Turbopack by testing with Webpack or the --no-turbo flag, as the issue does not reproduce in these scenarios.

Example

  • No specific code snippet can be provided without further details on the HMR listener implementation and the RSC bundler configuration.

Notes

  • The issue seems to be specific to the combination of Next.js 16.0.x, Turbopack, and the simultaneous use of HMR listeners in both the parent page and the iframe.
  • The provided environment information and package versions may be relevant in reproducing and debugging the issue.

Recommendation

  • Apply workaround: Implement a mechanism to handle HMR updates sequentially, avoiding the simultaneous use of HMR listeners in both the parent page and the iframe, as this is likely to mitigate the issue.

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