-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Describe the Bug
Since upgrading from Next.js 15.4.4 → 15.5.0 (and still in 15.5.6 and partially on 16.0.1), running dev with Turbopack causes Payload Admin HMR to frequently fail with:
Error: Could not find the module "<path>#SomeClientComponent" in the React Client Manifest.
This is probably a bug in the React Server Components bundler.
The error appears after edits that affect Payload Admin (e.g., field/collection schema changes). It loops for many entries from admin/importMap.js, sometimes for 1–2 minutes, and either eventually compiles or crashes.
The FE HRM works; the failures hit the Admin route rebuild. If our code changes doesn't trigger Admin UI / data schema changes it works fine.
Example from logs on Payload Website Template when I removed test field from FormBlock config:
(Next 15.5.x with SQLite)
✓ Compiled /admin/[[...segments]] in 153ms
○ Compiling /[slug] ...
Generating import map
No new imports found, skipping writing import map
[✓] Pulling schema from database...
? Warnings detected during schema push:
· You're about to delete test_import_maps column in pages_blocks_form_block table with 1 items
· You're about to delete test_import_maps column in _pages_v_blocks_form_block table with 1 items
DATA LOSS WARNING: Possible data loss detected if schema is pushed.
Accept warnings and push schema to database? › (y/N) ✓ Compiled /[slug] in 1271ms
[⣷] Pulling schema from database...
[✓] Pulling schema from database...
✔ Warnings detected during schema push:
· You're about to delete test_import_maps column in pages_blocks_form_block table with 1 items
· You're about to delete test_import_maps column in _pages_v_blocks_form_block table with 1 items
DATA LOSS WARNING: Possible data loss detected if schema is pushed.
Accept warnings and push schema to database? … yes
⨯ Error: Could not find the module "[project]/node_modules/.pnpm/@payloadcms+richtext-lexical@3.60.0_@faceless-ui+modal@3.0.0_react-dom@19.1.0_react@19._79568805ff5ee287636170a598c47824/node_modules/@payloadcms/richtext-lexical/dist/exports/client/index.js#InlineToolbarFeatureClient" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
at stringify (<anonymous>) {
digest: '1878333357'
}
⨯ Error: Could not find the module "[project]/node_modules/.pnpm/@payloadcms+richtext-lexical@3.60.0_@faceless-ui+modal@3.0.0_react-dom@19.1.0_react@19._79568805ff5ee287636170a598c47824/node_modules/@payloadcms/richtext-lexical/dist/exports/client/index.js#FixedToolbarFeatureClient" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
at stringify (<anonymous>) {
digest: '1906748461'
}
⨯ Error: Could not find the module "[project]/node_modules/.pnpm/@payloadcms+richtext-lexical@3.60.0_@faceless-ui+modal@3.0.0_react-dom@19.1.0_react@19._79568805ff5ee287636170a598c47824/node_modules/@payloadcms/richtext-lexical/dist/exports/client/index.js#HeadingFeatureClient" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
at stringify (<anonymous>) {
digest: '3441152301'
}
...
I initially suspected the dynamic regeneration of admin/importMap.js, but disabling auto-generation mportMap.autoGenerate produced the same behavior, so it’s not caused by the file changing during compile.
It looks like a race between Admin/FE/API compiles after file changes - Next’s logs show Turbopack compiling multiple routes concurrently. The issue began specifically with Next 15.5.0. In that release, Turbopack changed how it handles HMR after clearing the chunk cache - they removed code that delete From Require Cache the turbopack runtime (to fix memory leaks), and removed this TODO comment: Stop re-evaluating React Client once it relies on Turbopack's chunk cache.
- PR: [turbopack] Clear chunk cache on HMR instead of creating new next-server VM (#81664)
https://github.com/vercel/next.js/pull/81664/files
After this change, Admin’s client entries (many come from @payloadcms/richtext-lexical/client, @payloadcms/plugin-seo/client, and custom client UI in the import map) often aren’t present in the React Client Manifest at the time Admin is re-rendered during HMR.
With Next.js 16.0.1, behavior changes but seems related:
- Admin HMR often does not recompile at all when adding new fields (no UI update; only a full dev server restart reflects changes).
- On SQLite, removing a field triggers the migration prompt and does recompile Admin (and doesn’t error).
- On MongoDB, no Admin HMR whether adding or removing fields; restart required.
- If I trigger server restart via the
(N)browser widget in Next 16 (in preferences), the same React Client Manifest errors resurface—suggesting the underlying Turbopack/manifest issue still exists; it’s just masked when Admin HMR doesn’t run.
In next 16.0.1 they still clear cache with next__clear_chunk_cache and the code is very similar to 15.5.0:
https://github.com/vercel/next.js/blob/e08402bfad8db05b0df820daf4f08c9c65ab1f7b/packages/next/src/server/dev/hot-reloader-turbopack.ts#L388
So we have two probably related problems:
- Next 15.5.x: Admin HMR triggers, but frequently fails with Client Manifest errors (likely due to Turbopack chunk cache clearing).
- Next 16.0.1: Admin HMR often doesn’t run on schema additions; when Admin does rebuild (or after a restart), the same manifest errors can appear.
What I tried / findings
importMap.autoGenerate: false→ same errors on Next 15.5.x.- Importing the
admin/importMap.jsat higher route level / in FE (dev-only) → didn’t prevent errors. - Using Webpack (
next dev --no-turbo) → the issue does not occur. - Updated Node.js from 22 to 24, tested also on bun 1.3.1 - same issues. Runtime doesn't affect Turbopack here.
- Updated Payload to 60.1 - same issues.
- Next 16.0.1 still calls
__turbopack_clear_chunk_cache__in HMR codepaths; Admin HMR behavior seems changed (often not recompiling on schema add), but when the Admin does rebuild or after a restart, the same manifest errors occur.
Links giving more context:
- Blog post analysis of this class of failures with Payload Admin import maps + Turbopack (not mine):
https://www.buildwithmatija.com/blog/payload-turbopack-react-client-manifest-error-debugging - Next.js PR that changed HMR behavior (15.5.0):
https://github.com/vercel/next.js/pull/81664/files - Discord discussion about this issue: https://discord.com/channels/967097582721572934/1409901645868961854
Link to the code that reproduces this issue
https://github.com/LucasMatuszewski/turbopack-error-reproduction
Reproduction Steps
Link to the code that reproduces this issue
Minimal reproductions (Payload Website Template + small changes):
-
Next 15.5.x + Payload 3.60.0 + SQLite (React Client Manifest errors on HMR):
- https://github.com/LucasMatuszewski/turbopack-error-reproduction
- Commit with changes vs original template: LucasMatuszewski/turbopack-error-reproduction@070a35a
-
Next 16.0.1 + SQLite (Admin HMR does not recompile on field add, does on remove after DB migration; no manifest errors, no Admin UI changes until restart) :
-
Next 16.0.1 + MongoDB + Payload 3.61.1 (Admin HMR does not recompile on add/remove; restart required; manifest errors can reappear after using Next.js web widget to restart server from the browser):
I used Website template instead of Blank, to have more components in importMap.js including custom components and with some FE only UI components. To test which changes trigger errors, and which doesn't.
Reproduction Steps
(Use repo 1 for Next 15.5.x behavior; 2/3 for Next 16.0.1.)
For all 3 cases below I did changes in Page Collection and Form Block config fields that you can find in this PR:
LucasMatuszewski/turbopack-error-reproduction@6555f73
IMPORTANT: In my real app based on Next 15.5.6 & Payload 3.60.0 HMR sometimes work fine on 2-3 changes, and then suddenly I get these errors. Other time I get these errors immediately when I start the server or after first change in code.
So please try multiple times if you didn't get these errors immediately.
For Next 15.5.x (repo 1):
pnpm ipnpm dev(note:next dev --turbopackis in the script)- Open
/admin, go to Contact Page - Edit a collection or field schema (e.g., remove or add a field in the Pages collection, Form Block).
- Observe Turbopack HMR: Admin starts recompiling; within seconds, the console repeatedly prints “Could not find the module … in the React Client Manifest” for many entries from
admin/importMap.js. Sometimes it compiles after a long loop; other times it crashes.
For Next 16.0.1 + SQLite (repo 2):
pnpm ipnpm dev(Turbopack)- Open
/admin, go to Contact Page - Add a new field to a collection → Admin UI usually does not update (no HMR). Refresh doesn’t help. Restart required.
- Remove a field → Payload prompts DB migration; after accept, Admin HMR does rebuild and reflect change.
- If you restart via the new (N) widget, the React Client Manifest errors may appear again.
For Next 16.0.1 + MongoDB (repo 3):
pnpm ipnpm dev(Turbopack)- Open
/admin, go to Contact Page - Edit a collection/field (add or remove) → Admin UI does not update via HMR. Restart required.
- After restart, the manifest error can reappear
Which area(s) are affected?
area: core, area: templates
- Admin UI (import map / client components)
- Dev server / HMR
- Next.js adapter integration (Turbopack runtime)
- Client components in importMap.js (both plugins, core and custom components shows)
- Potential race condition when compiling Admin + FE + API concurrently
Environment Info
- OS: **Ubuntu 25.04**
- CPU: **Intel i7**
- Node.js: **22.16.0** and **24.11.0** + **Bun 1.3.1**
- pnpm: **10.15.0**
- Next.js:
- **15.5.6** (regression starts at **15.5.0**)
- **16.0.1** (different HMR behavior; underlying manifest error resurfaces after restart)
- React / react-dom: **19.1.0**
- Payload CMS: **3.60.0** (Next 15.5.x), **3.61.1** (Next 16 + Mongo)
- DBs tested:
- **SQLite** (Payload’s `@payloadcms/db-sqlite`)
- **MongoDB** (Payload 3.61.1 + mongoose adapter)
- Package manager: **pnpm**
- Dev script: `next dev --turbopack`
pnpm payload info - on Next.js 16.0.1, Payload 3.61.1 and Node 24.11.0
(I first tested on Next.js 15.5.6, Payload 3.60.0 and Node 22.14)
> turbopack-error-reproduction@1.0.0 payload /home/lucas/DEV/Learning/PayloadCMS/turbopack-error-reproduction
> cross-env NODE_OPTIONS=--no-deprecation payload info
npm warn Unknown env config "enable-pre-post-scripts". This will stop working in the next major version of npm.
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm.
npm warn Unknown env config "_jsr-registry". This will stop working in the next major version of npm.
npm warn Unknown project config "enable-pre-post-scripts". This will stop working in the next major version of npm.
This project is configured to use pnpm because /home/lucas/DEV/Learning/PayloadCMS/turbopack-error-reproduction/package.json has a "packageManager" field
Binaries:
Node: 24.11.0
npm: 11.6.1
Yarn: N/A
pnpm: 10.15.0
Relevant Packages:
payload: 3.61.1
next: 16.0.1
@payloadcms/db-mongodb: 3.61.1
@payloadcms/email-nodemailer: 3.61.1
@payloadcms/graphql: 3.61.1
@payloadcms/live-preview: 3.61.1
@payloadcms/live-preview-react: 3.61.1
@payloadcms/next/utilities: 3.61.1
@payloadcms/payload-cloud: 3.61.1
@payloadcms/plugin-form-builder: 3.61.1
@payloadcms/plugin-nested-docs: 3.61.1
@payloadcms/plugin-redirects: 3.61.1
@payloadcms/plugin-search: 3.61.1
@payloadcms/plugin-seo: 3.61.1
@payloadcms/richtext-lexical: 3.61.1
@payloadcms/translations: 3.61.1
@payloadcms/ui/shared: 3.61.1
react: 19.2.0
react-dom: 19.2.0
Operating System:
Platform: linux
Arch: x64
Version: #34-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 17 09:21:29 UTC 2025
Available memory (MB): 15240
Available CPU cores: 12