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
- Clear `.cache` and `public` and rebuild.
- Confirm Slices support matches across your Gatsby core and any SSR/slice plugins.
- If you do not need Slices, unset `GATSBY_SLICES`.
- 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
- Treat Slices as experimental: clear `.cache` whenever you toggle it.
- Keep Gatsby core and SSR/slice plugins version-aligned.
- Do not enable Slices in production pipelines until validated on a clean build.
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
- The result of this StaticQuery could not be fetched. This i
- Encountered unknown module type: ${module.type}. Please open
- Slice context "${slicesContext.renderEnvironment}" is not su
- Gatsby can't differentiate between themes ${matchingThemes.m
- Slice name "${sliceName}" not found when rendering slices
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/28bfa7d4c68c5288.
Report an issue: GitHub.