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

Segment Prefetch Of An ISR NotFound() Page Never Completes In Chromium When A Service Worker Mediates Fetches (Wedges Connections, Networkidle Never Reached)

Next.js segment cache abandons response bodies for rejected prefetch responses; with a service worker, unconsumed respondWith bodies cause Chromium to keep fetches pending forever, exhausting connections and breaking networkidle.

highConfidence 92%Next.jsReact Server ComponentsServer ActionsRoute HandlersAffected V16.2.12Affected V16.3.1-Canary.4

Origin Analysis

When a segment prefetch response is rejected (e.g. 404 from ISR notFound), the client code does not read or cancel the response body. With a service worker using respondWith, the unconsumed body keeps the request in flight indefinitely.
1. npm install && npx playwright install chromium 2. npm run build (fresh production build) and npm start 3. node probe.mjs — exits 1 when reproduced (deterministically on fresh build) Or by hand: open Chrome DevTools → Network on http://localhost:3000/, reload once (so the service worker controls the page), and watch the segment prefetches of the dead link stay pending forever.

Fixing Code Block

Edge Case Audit

Cancelling a body that is already being consumed elsewhere may throw; the try/catch prevents crashes. Ensure cancellation only after confirming response is not needed. This fix is safe for both service worker and non-SW environments but should be tested with streaming/prefetch scenarios. Rollback by removing cancellation lines; no migration needed.

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