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

Turbopack ValidateAppPaths Misses Dynamic Slug Conflicts When Sibling Routes Have Different Leaf Segments

`next build` succeeds even when dynamic segments at the same route depth use different names but different leaf segments, because validateAppPaths normalizes dynamic names to wildcards and only checks full normalized paths. At runtime, getSortedRoutes throws, causing server startup crash and potential crash loops on platforms like Vercel Fluid compute.

highConfidence 95%Next.jsReact Server Componentsnext buildRoute HandlersAffected V16.1.6

Origin Analysis

validateAppPaths replaces dynamic segment names with a wildcard and compares normalized full paths, so conflicts where dynamic segment names differ at the same tree depth but have different leaf segments (e.g., `/api/items/[item_id]/details` and `/api/items/[parent_item_id]/purge`) are not detected. Runtime getSortedRoutes builds a trie and enforces consistent dynamic segment names at the same depth, throwing immediately.
1. Clone https://github.com/pweisensee/nextjs-slug-conflict 2. Run `npm install` 3. Run `npm run build` — build exits 0 and lists both routes without error 4. Run `npm start` — server crashes immediately with `Error: You cannot use different slug names for the same dynamic path ('item_id' !== 'parent_item_id')`

Fixing Code Block

Edge Case Audit

This change will cause `next build` to fail for routes that previously built but crashed at runtime. This is intended but may break existing deployments that relied on the invalid routes (they would not have served requests anyway). Potential false positives could arise with parallel routes or interception routes if they intentionally use different dynamic names in sibling segments; test against such patterns before rollout. Rollback: remove the `getSortedRoutes(routes)` call if unexpected build failures occur.

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