{"record":{"id":"fabbb3b3286b05de","repo":"gatsbyjs/gatsby","slug":"it-appears-like-gatsby-is-misconfigured-jsonstore","errorCode":null,"errorMessage":"It appears like Gatsby is misconfigured. JSONStore is Gatsby internal development-only component and should never be used in production.\n\nUnless 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.","messagePattern":"It appears like Gatsby is misconfigured\\. JSONStore is Gatsby internal development-only component and should never be used in production\\.\n\nUnless 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\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/cache-dir/query-result-store.js","lineNumber":13,"sourceCode":"import React from \"react\"\nimport { StaticQueryContext } from \"gatsby\"\nimport {\n  registerPath as socketRegisterPath,\n  unregisterPath as socketUnregisterPath,\n} from \"./socketIo\"\nimport PageRenderer from \"./page-renderer\"\nimport normalizePagePath from \"./normalize-page-path\"\nimport loader, { getStaticQueryResults, getSliceResults } from \"./loader\"\nimport { SlicesResultsContext } from \"./slice/context\"\n\nif (process.env.NODE_ENV === `production`) {\n  throw new Error(\n    `It appears like Gatsby is misconfigured. JSONStore is Gatsby internal ` +\n      `development-only component and should never be used in production.\\n\\n` +\n      `Unless your site has a complex or custom webpack/Gatsby ` +\n      `configuration this is likely a bug in Gatsby. ` +\n      `Please report this at https://github.com/gatsbyjs/gatsby/issues ` +\n      `with steps to reproduce this error.`\n  )\n}\n\nconst getPathFromProps = props =>\n  props.pageResources && props.pageResources.page\n    ? normalizePagePath(props.pageResources.page.path)\n    : undefined\n\nexport class PageQueryStore extends React.Component {\n  constructor(props) {\n    super(props)\n    this.state = {","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/cache-dir/query-result-store.js#L1-L31","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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`)."],"exampleFix":"// before — custom webpack config interfering with dev/prod splitting\n// gatsby-node.js\nexports.onCreateWebpackConfig = ({ actions, stage }) => {\n  actions.setWebpackConfig({\n    optimization: { splitChunks: false }, // breaks dev/prod code splitting\n  })\n}\n\n// after — don't override optimization settings that control dev-only inclusion\nexports.onCreateWebpackConfig = ({ actions, stage }) => {\n  // only add legitimate, non-breaking customizations\n  actions.setWebpackConfig({\n    resolve: { alias: { '@components': path.resolve('src/components') } },\n  })\n}","handlingStrategy":"validation","validationCode":"// Verify NODE_ENV before building\nif (process.env.NODE_ENV !== 'production') {\n  console.warn('Building with NODE_ENV !== production may cause issues')\n}\n// Ensure consistent env:\n// gatsby build sets NODE_ENV=production automatically\n// gatsby develop sets NODE_ENV=development automatically","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["production","internal-module","webpack","node-env","dev-only","jsonstore"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}