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

Turbopack Panic: Index Out Of Bounds In Tree_shake/Graph.Rs:743 When Experimental.TurbopackTreeShaking Is Enabled

Next.js build crashes with a Rust panic in Turbopack's tree shaking pass when the experimental turbopackTreeShaking flag is enabled. The panic occurs during module graph traversal and is caused by an out-of-bounds index. A temporary workaround is to disable the experimental flag until an upstream fix is released.

highConfidence 85%Next.jsRoute HandlersReact Server ComponentsServer ActionsAffected V16.1.6Affected V16.2.4

Origin Analysis

Rust panic in turbopack-ecmascript tree_shake/graph.rs:743 due to an out-of-bounds index when processing a module graph with a specific import/export pattern (likely a circular or re-export edge case) while experimental tree shaking is enabled.
1. Clone the linked reproduction repository. 2. Ensure next.config.ts has experimental.turbopackTreeShaking: true. 3. Run pnpm install. 4. Run pnpm run build. 5. Build aborts with Rust panic at tree_shake/graph.rs:743.

Fixing Code Block

Edge Case Audit

Disabling tree shaking may result in larger bundle sizes and less optimized output. Once an official fix is released, remove this workaround and re-enable the flag to benefit from tree shaking. If you rely on tree shaking for production, consider downgrading to a Next.js version without the bug or wait for the patch.

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