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

Next.Js 16 Webpack Build Executes Dynamic /_Not-Found Route During Static Generation, Causing Side Effects And Font Retry Logs

In Next.js 16.2.1 with the webpack bundler, the /_not-found route is incorrectly rendered during build-time static generation despite being marked dynamic, leading to execution of component body and side effects (e.g., network calls). This behavior is not present with Turbopack and was absent in 14.2 webpack. Additionally, next/font/google retry logs appear during webpack builds but not Turbopack, increasing build time.

highConfidence 75%Next.jsTurbopackPages RouterAffected V16.2.1

Origin Analysis

Webpack's static generation pipeline does not exclude the special dynamic route /_not-found from pre-rendering, unlike Turbopack; the webpack builder attempts to render it to determine static eligibility, causing side effects, while Turbopack's static analysis correctly skips it. The font retry logs are a separate symptom of webpack's font loader performing network fetches and retries during build.
1. Clone https://github.com/chandra2607/nextjs-webpack-turbopack-issue.git 2. Run `docker build --build-arg BUILD_CMD=build:webpack -t repro-webpack .` 3. Observe build logs contain `[not-found] component evaluated` and `Retrying 1/3...` 4. Run `docker build --build-arg BUILD_CMD=build -t repro-turbo .` and compare: no such logs.

Fixing Code Block

Edge Case Audit

This patch forces /_not-found to be dynamic, which matches the current observed behavior in both webpack and Turbopack and should not introduce regressions. However, if a future version of Next.js intends to statically pre-render /_not-found (e.g., for static 404.html generation), this patch would prevent that and would need to be revisited. Rollback is straightforward: remove the added conditional block. The patch does not affect font fetching or retry logs; users may still see 'Retrying 1/3...' during webpack builds. In concurrent or multi-threaded builds, the patch is safe because it purely changes classification and does not alter shared state.

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