gatsbyjs/gatsby · error · Error

couldn't find async-requires module

Error message

couldn't find async-requires module

What it means

After the partial-hydration webpack plugin rewrote module connections, the async-requires module could not be located in the compilation. It is a build-internal invariant — the client entries depend on that module existing — typically caused by a compiler hook ordering issue or unusual bundling config.

Source

Thrown at packages/gatsby/src/utils/webpack/plugins/partial-hydration.ts:289

                  // will import it. We don't want to force remove template - we just want to remove the
                  // import from async-requires and let webpack remove it rom the bundle (or rather just not add it)
                  // if it's not used anywhere else
                  compilation.moduleGraph.removeConnection(
                    connection.dependency
                  )
                }
              }
            }
          }

          // find css modules that are imported by this module
          collectCssModules(module)
        }
      }
    }

    if (!asyncRequires) {
      throw new Error(`couldn't find async-requires module`)
    }

    const clientSSRLoader = `gatsby/dist/utils/webpack/loaders/client-components-requires-writer-loader?${JSON.stringify(
      {
        modules: clientModules
          .map(
            module =>
              `./` +
              path.relative(
                compilation.options.context as string,
                module.userRequest
              )
          )
          .join(`,`),
      }
    )}!`

    const clientComponentEntryDep = webpack.EntryPlugin.createDependency(

View on GitHub (pinned to e85d62f177)

Solutions

  1. Disable partial hydration (engines.experimental | functions) if unneeded
  2. Update Gatsby to a version fixing partial-hydration module resolution
  3. Inspect webpack config overrides that remove async-requires
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at packages/gatsby/src/utils/webpack/plugins/partial-hydration.ts:289 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/73c9732ad0eca191. Report an issue: GitHub.