gatsbyjs/gatsby · error

something changed in webpack but I don't know what

Error message

something changed in webpack but I don't know what

What it means

In Gatsby v5 with `GATSBY_SLICES` enabled, after webpack emits SSR template hashes Gatsby expects every emitted `templatePath` to exist in the Redux `components` map. A missing entry means webpack produced a template the runtime registry does not know about, so the message literally admits the cause is unknown.

Source

Thrown at packages/gatsby/src/commands/build.ts:436

          const component = store.getState().components.get(templatePath)
          if (component) {
            const action = {
              type: `SET_SSR_TEMPLATE_WEBPACK_COMPILATION_HASH`,
              payload: {
                templatePath,
                templateHash,
                pages: component.pages,
                isSlice: component.isSlice,
              },
            }
            store.dispatch(action)
          } else {
            console.error({
              templatePath,
              templateHash,
              availableTemplates: [...store.getState().components.keys()],
            })
            throw new Error(
              `something changed in webpack but I don't know what`
            )
          }
        }
      )
    }

    if (state.html.ssrCompilationHash !== webpackSSRCompilationHash) {
      store.dispatch({
        type: `SET_SSR_WEBPACK_COMPILATION_HASH`,
        payload: webpackSSRCompilationHash,
      })
    }
  }

  await flushPendingPageDataWrites(buildSpan)
  markWebpackStatusAsDone()

View on GitHub (pinned to 8b06340921)

Solutions

  1. Clear `.cache` and `public` and rebuild.
  2. Confirm Slices support matches across your Gatsby core and any SSR/slice plugins.
  3. If you do not need Slices, unset `GATSBY_SLICES`.
  4. Capture the `console.error` output (templatePath, hash, availableTemplates) and file a Gatsby issue.
Defensive patterns

Strategy: validation

Validate before calling

// In CI, decide Slices support explicitly and fail fast on mismatch.
if (process.env.GATSBY_SLICES && !supportsSlices(gatsbyVersion)) {
  throw new Error("GATSBY_SLICES set but Gatsby version does not support it")
}

Prevention

When it happens

Trigger: `process.env.GATSBY_SLICES` is set; the `templateCompilationHashes` iteration hits a `templatePath` for which `store.getState().components.get(templatePath)` returns `undefined`.

Common situations: Experimental/preview Slices feature mismatched with plugin or Gatsby versions; stale `.cache` after enabling Slices; a third-party template/SSR plugin registering templates differently.

Related errors


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