nextjs - 💡(How to fix) Fix [Turbopack]: Critical useInsertionEffect TypeError, possibly related to earlier bug in stable Area [7 comments, 4 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#84784Fetched 2026-04-08 02:18:22
View on GitHub
Comments
7
Participants
4
Timeline
17
Reactions
0
Author
Assignees
Timeline (top)
commented ×7labeled ×3assigned ×1closed ×1

Error Message

When running the development server with Turbopack (next dev --turbo), the application is highly unstable and exhibits multiple, distinct runtime errors. The exact error depends on the Next.js version and the application state.

Error: Cannot read properties of null (reading 'useInsertionEffect')

  • During HMR / Subsequent Renders: A second error related to Hot Module Replacement appears, indicating that Turbopack has lost track of critical modules.

Runtime Error: Module [next]/entry/page-loader.ts ... was instantiated ... but the module factory is not available. It might have been deleted in an HMR update.

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:45 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T8103
  Available memory (MB): 8192
  Available CPU cores: 8
Binaries:
  Node: 24.1.0
  npm: 11.3.0
  Yarn: N/A
  pnpm: 10.14.0
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  eslint-config-next: 15.5.4
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/divine-worker-fcjfpt

To Reproduce

  1. Open the provided CodeSandbox link.
  2. Ensure the Next.js version is set to 16.0.0-canary.1 or later.
  3. Run the development server.
  4. Load the application preview.
  5. Observe the fatal useInsertionEffect TypeError in the browser console.

Current vs. Expected behavior

Current Behavior

When running the development server with Turbopack (next dev --turbo), the application is highly unstable and exhibits multiple, distinct runtime errors. The exact error depends on the Next.js version and the application state.

1. On Next.js 16.0.0-canary.1 (in CodeSandbox):

Two separate errors are observed:

  • On Initial Load: The application crashes immediately with a fatal Runtime TypeError. This prevents the component from rendering at all.

    Error: Cannot read properties of null (reading 'useInsertionEffect')

  • During HMR / Subsequent Renders: A second error related to Hot Module Replacement appears, indicating that Turbopack has lost track of critical modules.

    Runtime Error: Module [next]/entry/page-loader.ts ... was instantiated ... but the module factory is not available. It might have been deleted in an HMR update.

2. On Next.js 15.5.4 (stable, original environment):

The application crashes when a specific component renders, throwing a different Runtime TypeError.

Runtime TypeError: (...).call is not a function

This collection of errors demonstrates significant instability in Turbopack. The application works perfectly with the default Webpack bundler (next dev) in all scenarios.

Expected Behavior

The application should load and run without any runtime errors when using the Turbopack development server (next dev --turbo). Its behavior and stability should be consistent with the Webpack development server. HMR updates should apply successfully without causing the module factory to become unavailable.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:45 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T8103
  Available memory (MB): 8192
  Available CPU cores: 8
Binaries:
  Node: 24.1.0
  npm: 11.3.0
  Yarn: N/A
  pnpm: 10.14.0
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  eslint-config-next: 15.5.4
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.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

No response

extent analysis

TL;DR

The most likely fix is to upgrade to a newer version of Next.js or apply a workaround to mitigate the Turbopack instability issues.

Guidance

  • Verify that the issue persists when using the latest version of Next.js, as the provided CodeSandbox link uses 16.0.0-canary.1.
  • Try disabling Hot Module Replacement (HMR) or switching to the default Webpack bundler (next dev) to see if the issue is specific to Turbopack.
  • Check the compatibility of the react and react-dom versions (19.1.0) with the used Next.js version, as the useInsertionEffect error might be related to a version mismatch.
  • Consider downgrading the react and react-dom versions to a version compatible with the used Next.js version, if an upgrade to a newer Next.js version is not feasible.

Example

No specific code snippet can be provided without modifying the original code, but ensuring that all dependencies are up-to-date and compatible is crucial.

Notes

The issue seems to be related to the instability of Turbopack in the used Next.js version. Upgrading to a newer version of Next.js or applying workarounds to mitigate the Turbopack issues might resolve the problem. However, without more information about the specific use case and requirements, it's difficult to provide a more detailed solution.

Recommendation

Apply a workaround, such as disabling HMR or switching to the default Webpack bundler, as upgrading to a fixed version of Next.js might not be feasible or immediately available. This workaround can help mitigate the Turbopack instability issues until a more permanent solution is available.

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