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

CacheComponents: Runtime ISR Revalidation Throws Message-Less StaticGenBailoutError; Real Reason Only On Console.Error

During background ISR revalidation with cacheComponents enabled, throwIfDisallowedDynamic throws a StaticGenBailoutError with no message or cause. The detailed violation is logged only to console.error via logDisallowedDynamicError, so error trackers receive an empty, unactionable Error event.

highConfidence 87%Next.jsRoute HandlersTurbopackAffected V16.2.9

Origin Analysis

throwIfDisallowedDynamic in packages/next/src/server/app-render/dynamic-rendering.ts constructs `new StaticGenBailoutError()` with no arguments after calling logDisallowedDynamicError, discarding the already-computed dynamic violation message. This is a design flaw in the error-surfacing path: the sentinel error carries no diagnostic context, only the synchronous console output does.
1. Configure Next.js 16.2.9 with `cacheComponents: true` and a fully static route. 2. In a section fetcher catch block, trigger disallowed dynamic usage (e.g. `crypto.randomUUID()` via Sentry <10.57.0, or `Date.now()`) during a background ISR revalidation (handleRevalidate). 3. Observe the revalidation abort and the forwarded error in onRequestError: the Error message is empty, minified stack only; the real reason (e.g. "Route ... used `crypto.randomUUID()` ...") appears only in console.error/function logs.

Fixing Code Block

Edge Case Audit

This change only modifies the message of a thrown sentinel error; rollback is safe with `git revert`. Potential secondary risks: (1) if the dynamic error message contains sensitive route or query information, it may now appear in error trackers; review message content and scrub PII if necessary. (2) Some tests or downstream error-parsing logic may assert on empty messages; update snapshots accordingly. (3) The `dynamicErrors` array may be empty in edge cases; the fallback prevents undefined messages. (4) This does not address the root dynamic violation itself, only its observability.

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