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.jsAffected 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