gatsbyjs/gatsby · error
It appears like Gatsby is misconfigured. JSONStore is Gatsby
Error message
It appears like Gatsby is misconfigured. JSONStore is Gatsby internal development-only component and should never be used in production. Unless your site has a complex or custom webpack/Gatsby configuration this is likely a bug in Gatsby. Please report this at https://github.com/gatsbyjs/gatsby/issues with steps to reproduce this error.
What it means
Thrown at module evaluation time in query-result-store.js when process.env.NODE_ENV is 'production'. JSONStore is a development-only internal React component that reads static query results from the dev server; it must never ship in production bundles. If webpack includes this module in the production build, the module-level check fires immediately.
Source
Thrown at packages/gatsby/cache-dir/query-result-store.js:13
import React from "react"
import { StaticQueryContext } from "gatsby"
import {
registerPath as socketRegisterPath,
unregisterPath as socketUnregisterPath,
} from "./socketIo"
import PageRenderer from "./page-renderer"
import normalizePagePath from "./normalize-page-path"
import loader, { getStaticQueryResults, getSliceResults } from "./loader"
import { SlicesResultsContext } from "./slice/context"
if (process.env.NODE_ENV === `production`) {
throw new Error(
`It appears like Gatsby is misconfigured. JSONStore is Gatsby internal ` +
`development-only component and should never be used in production.\n\n` +
`Unless your site has a complex or custom webpack/Gatsby ` +
`configuration this is likely a bug in Gatsby. ` +
`Please report this at https://github.com/gatsbyjs/gatsby/issues ` +
`with steps to reproduce this error.`
)
}
const getPathFromProps = props =>
props.pageResources && props.pageResources.page
? normalizePagePath(props.pageResources.page.path)
: undefined
export class PageQueryStore extends React.Component {
constructor(props) {
super(props)
this.state = {View on GitHub (pinned to 8b06340921)
Solutions
- Run `gatsby clean` and rebuild to ensure a fresh production build.
- Remove or review custom webpack config in gatsby-node.js that might alter module resolution or DefinePlugin behavior.
- Verify NODE_ENV is set correctly: 'production' for `gatsby build`, 'development' for `gatsby develop`.
- Ensure all @gatsby packages are at compatible versions (check for version mismatches with `npm ls gatsby`).
Example fix
// before — custom webpack config interfering with dev/prod splitting
// gatsby-node.js
exports.onCreateWebpackConfig = ({ actions, stage }) => {
actions.setWebpackConfig({
optimization: { splitChunks: false }, // breaks dev/prod code splitting
})
}
// after — don't override optimization settings that control dev-only inclusion
exports.onCreateWebpackConfig = ({ actions, stage }) => {
// only add legitimate, non-breaking customizations
actions.setWebpackConfig({
resolve: { alias: { '@components': path.resolve('src/components') } },
})
} Defensive patterns
Strategy: validation
Validate before calling
// Verify NODE_ENV before building
if (process.env.NODE_ENV !== 'production') {
console.warn('Building with NODE_ENV !== production may cause issues')
}
// Ensure consistent env:
// gatsby build sets NODE_ENV=production automatically
// gatsby develop sets NODE_ENV=development automatically Prevention
- Do not override NODE_ENV in custom build scripts — let Gatsby manage it.
- Avoid custom webpack config that alters module optimization or DefinePlugin.
- Keep all Gatsby-related packages at compatible versions.
- Run `gatsby clean` after changing build configuration.
When it happens
Trigger: The query-result-store.js module is evaluated in a production build context, meaning webpack did not exclude or tree-shake the dev-only code path. This is a Gatsby/webpack build configuration problem, not an application-level error.
Common situations: Custom webpack config that changes module resolution or optimization settings, a Gatsby version mismatch between packages, a plugin that forces dev-only modules into production bundles, or a misconfigured NODE_ENV (set to 'development' during build but 'production' at runtime, or vice versa).
Related errors
- We couldn't find the correct component chunk with the name "
- Loading indicator should never be imported in code that does
- ${err}
- Couldn't find layout component at "${GATSBY_LAYOUT_COMPONENT
- We couldn't find the correct component chunk with the name "
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/fabbb3b3286b05de.
Report an issue: GitHub.