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

Windows: Next Build Crashes In CreateActionAssets Due To Missing ServerActionModules Entry

On Windows, production webpack builds crash with TypeError because createActionAssets assumes every server action worker has a corresponding entry in serverActionModules, but that map is empty while serverActions.workers is populated.

highConfidence 85%Next.jsAffected V16.2.11

Origin Analysis

Windows-specific path or module resolution discrepancy prevents the traverseModules/optimizeModules pass from populating pluginState.serverActionModules, while serverActions workers are still registered. The unguarded lookup pluginState.serverActionModules[name][layer === WEBPACK_LAYERS.actionBrowser ? 'client' : 'server'] then throws on undefined.
1. On Windows (GitHub windows-latest), run next build with webpack (not Turbopack) on an App Router app that has no first-party Server Actions but depends on a package that registers actions (e.g., @clerk/nextjs keyless mode). 2. Build compiles routes and crashes in createActionAssets. 3. Observe TypeError: Cannot read properties of undefined (reading 'client').

Fixing Code Block

Edge Case Audit

This is a patch-package style hotfix: it masks the underlying Windows path/module population bug and may be overwritten on Next.js upgrade, restoring the crash. If the application later introduces first-party server actions, silently skipping missing module entries could omit action assets at runtime, causing hard-to-debug errors. Rollback: remove the patch and upgrade to an official fixed Next.js version when available.

Ecosystem Topology