gatsbyjs/gatsby · critical
Could not find Redux store
Error message
Could not find Redux store
What it means
assertStore is a TypeScript assertion function that checks the Redux store was passed to a Gatsby internal function. If store is undefined, it panics -- meaning the caller (an internal pipeline step) was invoked without the store being initialized. This is an internal invariant guard used across bootstrap steps like writeOutRequires.
Source
Thrown at packages/gatsby/src/utils/assert-store.ts:6
import { Store } from "redux"
import reporter from "gatsby-cli/lib/reporter"
export function assertStore(store?: Store): asserts store {
if (!store) {
reporter.panic(`Could not find Redux store`)
}
}
View on GitHub (pinned to 8b06340921)
Solutions
- Run `gatsby clean` and restart -- this is an internal invariant that should not be user-reachable.
- Update Gatsby to the latest version.
- If calling Gatsby internals programmatically, ensure the Redux store is initialized and passed to all steps.
- Report a bug with a reproduction if it occurs on a clean latest-version install.
Defensive patterns
Strategy: type-guard
Type guard
// Assert store is present before calling functions that use assertStore
function hasStore(ctx) {
return ctx && ctx.store != null && typeof ctx.store.getState === 'function' && typeof ctx.store.dispatch === 'function'
}
if (!hasStore(context)) {
throw new Error('Redux store not initialized in context')
} Prevention
- This is an internal invariant -- restart the build if encountered.
- Keep Gatsby updated.
- When using Gatsby programmatically, always initialize and pass the Redux store.
When it happens
Trigger: Calling a function that calls assertStore(store) when the store parameter was not provided -- i.e. a partial context object missing the store key. This is an internal API contract violation, not user-facing misconfiguration.
Common situations: Internal pipeline ordering issue where a step runs before the Redux store is created. Programmatic API misuse calling internal functions without a store. A regression in the bootstrap sequence.
Related errors
- Missing required params
- An error occurred building the slug parts. This is likely a
- Could not find matching operation for ${requestedPathOnDisk}
- Slice context "${slicesContext.renderEnvironment}" is not su
- The result of this StaticQuery could not be fetched. This i
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/cd8670d384eb790e.
Report an issue: GitHub.