{"record":{"id":"cd8670d384eb790e","repo":"gatsbyjs/gatsby","slug":"could-not-find-redux-store","errorCode":null,"errorMessage":"Could not find Redux store","messagePattern":"Could not find Redux store","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/gatsby/src/utils/assert-store.ts","lineNumber":6,"sourceCode":"import { Store } from \"redux\"\nimport reporter from \"gatsby-cli/lib/reporter\"\n\nexport function assertStore(store?: Store): asserts store {\n  if (!store) {\n    reporter.panic(`Could not find Redux store`)\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":9,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/utils/assert-store.ts#L1-L9","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Assert store is present before calling functions that use assertStore\nfunction hasStore(ctx) {\n  return ctx && ctx.store != null && typeof ctx.store.getState === 'function' && typeof ctx.store.dispatch === 'function'\n}\n\nif (!hasStore(context)) {\n  throw new Error('Redux store not initialized in context')\n}","tryCatchPattern":null,"preventionTips":["This is an internal invariant -- restart the build if encountered.","Keep Gatsby updated.","When using Gatsby programmatically, always initialize and pass the Redux store."],"tags":["redux","store","internal","invariant","assertion"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}