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

Static Export Link Prefetch={True} Breaks Navigation

In Next.js static export (output: export), using Link with prefetch={true} causes the browser to fetch a non-existent RSC endpoint (/page1?_rsc=...), which returns HTML instead of RSC payload. Clicking the link then has no effect, breaking navigation. Setting prefetch="auto" works correctly by fetching static files like /page1.txt.

highConfidence 85%Next.jsTurbopackReact Server ComponentsAffected V16.0.0Affected V16.0.11Affected V16.1.0Affected V16.2.2

Origin Analysis

The Link component's prefetch={true} mode unconditionally triggers RSC prefetching (/_rsc=...), which is only valid in server runtime. In static export, there is no such endpoint, so the request returns HTML, the prefetch fails silently, and the subsequent click handler assumes a successful prefetch and does nothing. The correct behavior for static export is to use the static file prefetch strategy (fetching /page1.txt) or disable prefetch entirely.
1. Clone https://github.com/mdj-uk/static-export-prefetch-bug 2. Run `pnpm install` and `pnpm build` (Next.js output: export) 3. Serve the output with `pnpm dlx serve out` 4. Open http://localhost:3000/ and observe network requests 5. Notice a GET request to /page1?_rsc=... returning HTML 6. Click the link to /page1: nothing happens, no error

Fixing Code Block

Edge Case Audit

This fix changes behavior only in static export mode when prefetch is true. In non-export mode, no change occurs. However, if process.env.__NEXT_EXPORT is not reliably set in some edge cases (e.g., custom server with export-style output), the guard may fail, causing the original bug. Additionally, concurrent prefetches of multiple static files might increase initial network load, similar to auto prefetch; monitor performance. Rollback: if this patch causes unexpected regressions, revert to the original file and advise users to set prefetch="auto" or prefetch={false} as a temporary workaround. No data loss or security impact expected.

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