AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

TypeError: Cannot Redefine Property: Default In Next.Js Canary (Turbopack) With Pnpm On Windows

A fresh Next.js app using pnpm and next@16.2.1-canary.26 crashes on `pnpm dev` with `TypeError: Cannot redefine property: default` at `Object.freeze`. The issue is linked to Turbopack's interaction with pnpm's symlinked dependency layout, causing duplicate module instances that conflict when Next.js attempts to freeze default exports.

highConfidence 78%Next.jsTurbopackHydrationAffected V16.2.1-Canary.26

Origin Analysis

Next.js 16 canary on Windows + pnpm uses Turbopack for dev. pnpm's symlinked node_modules leads to the same module (e.g., React or an internal Next.js module) being instantiated multiple times. Turbopack then attempts to call `Object.freeze` on a module's namespace or default export, but the `default` property has already been defined as non-configurable on another instance, triggering `TypeError: Cannot redefine property: default`. Node 24's stricter property descriptors likely exacerbate the issue.
1. Run `pnpm create next-app .` and accept defaults. 2. Run `pnpm install` if needed. 3. Run `pnpm dev`. 4. Observe immediate crash with `TypeError: Cannot redefine property: default`.

Fixing Code Block

Edge Case Audit

Using `node-linker=hoisted` reduces pnpm's strict dependency isolation and may lead to phantom dependencies or mask other latent issues. This is a temporary workaround; once the upstream Next.js fix is released, remove the `.npmrc` entry and run `pnpm install` to restore the default isolated layout. Also, this fix only addresses pnpm environments and does not help with npm or Yarn.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state