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

Server Action Responses Bypass DeploymentId Version Skew Detection, Crashing Stale Tabs With "Module Factory Is Not Available"

When a deploymentId is configured, Server Action responses do not include the x-nextjs-deployment-id header, so stale clients cannot detect version skew and attempt to apply incompatible flight data, causing a Turbopack runtime crash.

highConfidence 95%Next.jsHydrationTurbopackAffected V16.3.6Affected V16.4.0-Canary.43

Origin Analysis

In build/templates/app-page.ts, the x-nextjs-deployment-id header is only set when `isRSCRequest && !isPossibleServerAction && deploymentId`. Server Action requests are excluded, so the client-side server-action-reducer never receives the deployment ID and skips the build mismatch comparison, applying flight data from the new deployment into the old runtime.
1. Configure a shared NEXT_SERVER_ACTIONS_ENCRYPTION_KEY and set deploymentId to 'a' or 'b' per the self-hosting guide. 2. Build deployment 'a' and deployment 'b' where 'b' includes a new client component and a bootstrap chunk change. 3. In a browser, open the app served by deployment 'a'. 4. Replace the server process with deployment 'b' on the same port without reloading the page. 5. Submit a form that invokes a Server Action calling revalidatePath('/'). 6. Observe that the action returns 200 without x-nextjs-deployment-id, the stale page loads 'b' client chunks, and the client crashes with "module factory is not available".

Fixing Code Block

Edge Case Audit

This change may cause additional full page reloads in rolling deploy scenarios when the deployment ID differs, which is the intended behavior. Ensure that any proxy or CDN caching does not strip or override the header. Rollback: revert this change and use the config header workaround described in the issue. Test thoroughly with Server Action redirects, revalidatePath, and concurrent deployments.

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