gatsbyjs/gatsby · critical

12200

12200

Error message

Tried to create adapter routes for webpack assets but failed. If the issue persists, please open an issue with a reproduction at https://gatsby.dev/bug-report for more help.

What it means

When using a Gatsby adapter (custom hosting integration, e.g. Gatsby Cloud, Firebase, AWS), Gatsby generates routes for webpack assets during the adapter route-creation phase. If the webpackAssets collection is null or undefined at that point, the adapter cannot register static routes for JS/CSS bundles, so it panics with error code 12200.

Source

Thrown at packages/gatsby/src/utils/adapter/manager.ts:486

      path: staticQueryResultPath,
      pathToFillInPublicDir: staticQueryResultPath,
      headers: MUST_REVALIDATE_HEADERS,
    })
  }

  // app-data.json
  {
    const appDataFilePath = posix.join(`page-data`, `app-data.json`)
    addStaticRoute({
      path: appDataFilePath,
      pathToFillInPublicDir: appDataFilePath,
      headers: MUST_REVALIDATE_HEADERS,
    })
  }

  // webpack assets
  if (!webpackAssets) {
    reporter.panic({
      id: `12200`,
      context: {},
    })
  }

  for (const asset of webpackAssets) {
    addStaticRoute({
      path: asset,
      pathToFillInPublicDir: asset,
      headers: PERMAMENT_CACHING_HEADERS,
    })
  }

  // chunk-map.json
  {
    const chunkMapFilePath = posix.join(`chunk-map.json`)
    addStaticRoute({
      path: chunkMapFilePath,

View on GitHub (pinned to 8b06340921)

Solutions

  1. Ensure a full successful `gatsby build` ran before the adapter route creation phase -- check for earlier build errors in the log.
  2. Update the adapter package and Gatsby core to mutually compatible latest versions.
  3. Run `gatsby clean` and rebuild from scratch.
  4. If writing a custom adapter, ensure the build context includes webpackAssets before route creation -- verify the adapter API contract.
Defensive patterns

Strategy: validation

Validate before calling

// Verify webpack assets exist before adapter route creation
function validateWebpackAssetsForAdapter(buildContext) {
  if (!buildContext.webpackAssets || !Array.isArray(buildContext.webpackAssets)) {
    throw new Error('webpackAssets not populated -- ensure full build ran before adapter routes')
  }
  if (buildContext.webpackAssets.length === 0) {
    console.warn('webpackAssets is empty -- check for earlier build failures')
  }
}

Type guard

function hasWebpackAssets(ctx) {
  return (
    typeof ctx === 'object' &&
    ctx !== null &&
    Array.isArray(ctx.webpackAssets) &&
    ctx.webpackAssets.length > 0
  )
}

Prevention

When it happens

Trigger: The webpackAssets variable is falsy when createAdapterRoutes (or equivalent) reaches the webpack-assets loop. This means the build state was not populated with the list of emitted webpack assets -- typically because an earlier build step (webpack compilation / stats extraction) failed or was skipped.

Common situations: Using a custom adapter or gatsby-plugin adapter integration where the build did not produce webpack stats. A build that bypassed or failed the HTML/JS compilation phase. Adapter misconfiguration or version incompatibility between Gatsby core and the adapter package.

Related errors


AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13). Data as JSON: /api/errors/1d013357dec48cc6. Report an issue: GitHub.