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

Turbopack Module Fragments Panic When Passing A Plain Function Export From A 'Use Client' Module As Prop

Next.js 16.5.0-canary.3 with `turbopackModuleFragments` enabled panics during build with `ModuleId not found for ident ... [app-client] (ecmascript) <internal part 0>` when a server component references a plain function exported from a 'use client' module that imports another module.

highConfidence 85%Next.jsPages RouterHydrationnext buildAffected V16.5.0-Canary.3

Origin Analysis

Turbopack's module fragmentation assigns an internal part identifier (<internal part 0>) to the exported function, but fails to register a module ID for that part in the chunk item content, causing `ModuleId not found` during `EcmascriptModuleContent::new`. The bug is triggered by the combination of a plain function export (no JSX) and an import inside the 'use client' module.
1. Clone https://github.com/stefanprobst/turbopack-module-fragments-repro 2. pnpm install 3. pnpm run build 4. Observe panic in Turbopack with error 'ModuleId not found for ident ... [app-client] (ecmascript) <internal part 0>'

Fixing Code Block

Edge Case Audit

Disabling module fragments may increase client bundle size and remove the intended chunk splitting optimizations in this canary version. This is a temporary workaround, not a permanent fix. Roll back by removing the flag once a patched Next.js version is released. Also verify the config option is supported in your version; in older versions the flag may be ignored or cause a warning.

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