Skip to content

[Turbopack]: Critical useInsertionEffect TypeError, possibly related to earlier bug in stable Area #84784

@Lukas2019

Description

@Lukas2019

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions