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

Turbopack Production Build Fails With 'Expected Chunkable Module For Async Reference' When Using Bknd

Next.js 16.3.5 production build using Turbopack panics with a TurbopackInternalError: 'expected chunkable module for async reference' when the bknd package is used. The webpack build succeeds, indicating a Turbopack-specific issue with async module chunking.

highConfidence 65%Next.jsRoute Handlersnext buildServer ActionsAffected V16.3.5

Origin Analysis

Turbopack's client chunking context encounters an async reference to a module that is not chunkable (likely a CommonJS or native module from bknd), and lacks a graceful fallback for such non-ECMAScript modules in the async import graph.
1. Install bknd: `bun install bknd` 2. Run production build with Turbopack: `bun run build` 3. Observe FATAL: expected chunkable module for async reference 4. Run `next build --webpack` to see successful build.

Fixing Code Block

Edge Case Audit

Using webpack removes Turbopack performance benefits and may expose different bundling behavior. Any Turbopack-specific optimizations (e.g., turbopackMinify) will be disabled. To rollback, remove the --webpack flag from the build script when the underlying Turbopack bug is fixed.

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