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

  1. Run `gatsby clean` and restart -- this is an internal invariant that should not be user-reachable.
  2. Update Gatsby to the latest version.
  3. If calling Gatsby internals programmatically, ensure the Redux store is initialized and passed to all steps.
  4. 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

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


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