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

Inability To Disable Dynamic Params With Cache Components Triggers Costly PPR Fallback For Unknown Routes

Next.js 16.3.0-canary.62 with cacheComponents enabled rejects `dynamicParams = false` in route segment config, causing `/ [slug]` to become a Partial Prerender route. Unknown slugs now trigger server function invocations on Vercel, wasting CPU time and money instead of returning a static 404.

highConfidence 75%Next.jsPages RouterServer ActionsApp RouterAffected V16.3.0-Canary.62

Origin Analysis

The Next.js build check disallows `dynamicParams = false` when `nextConfig.cacheComponents` is enabled, forcing the dynamic route into Partial Prerendering (PPR) fallback mode. Consequently, any request for a non-generated slug invokes the route's server function at runtime instead of being served as a static 404.
1. Clone the reproduction repo (https://github.com/lourd/descioli.com) and install dependencies. 2. Checkout the `cache-components` branch. 3. Run `pnpm build`. 4. Observe build output: `/[slug]` is rendered as Partial Prerender (◐) instead of SSG (●), and the presence of a `/[slug]` route indicates fallback for unknown slugs. 5. Attempt to access a non-existent slug on Vercel; it triggers a function invocation that takes seconds and returns 404.

Fixing Code Block

Edge Case Audit

This middleware runs on Edge for all matching requests, which still incurs a (much smaller) function invocation cost on Vercel. The staticSlugs list duplicates the slugs from `generateStaticParams`, creating a maintenance burden and a risk of drift. If a new slug is added to `generateStaticParams` but not to the middleware, it will incorrectly return 404. Once Next.js adds native support for `dynamicParams = false` with `cacheComponents`, this middleware should be removed. Test thoroughly in preview before deploying.

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