{"record":{"id":"60adb531edcde32a","repo":"gatsbyjs/gatsby","slug":"error-loading-a-result-for-the-page-query-in-pa","errorCode":null,"errorMessage":"Error loading a result for the page query in \"${pagePath}\". Query was not run and no cached result was found.","messagePattern":"Error loading a result for the page query in \"(.+?)\"\\. Query was not run and no cached result was found\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/get-page-data.ts","lineNumber":118,"sourceCode":"      throw new Error(\n        `Couldn't get query results for \"${pagePath}\" in ${(\n          initialWaitForMs / 1000\n        ).toFixed(3)}s.`\n      )\n    })\n  }\n}\n\nasync function readPageData(pagePath): Promise<IPageDataWithQueryResult> {\n  const { program } = store.getState()\n\n  try {\n    return await readPageDataUtil(\n      path.join(program.directory, `public`),\n      pagePath\n    )\n  } catch (err) {\n    throw new Error(\n      `Error loading a result for the page query in \"${pagePath}\". Query was not run and no cached result was found.`\n    )\n  }\n}\n","sourceCodeStart":100,"sourceCodeEnd":123,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/utils/get-page-data.ts#L100-L123","documentation":"readPageData reads the page-data JSON from public/ via readPageDataUtil; if that read fails it throws a generic message indicating the page query was never run and no cached result exists on disk.","triggerScenarios":"The page-data file is missing on disk (build never ran queries for that page), the public dir is incomplete, or the file is corrupted/unreadable.","commonSituations":"First dev start before any query has run; interrupted build leaving public half-written; manually deleted public/page-data; query extraction failed silently.","solutions":["Run gatsby develop / gatsby build so queries run and page-data is written.","Clear .cache and public and rebuild from scratch.","Confirm the page component compiles and its query extracts without error."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const fs = require('fs')\nconst path = require('path')\nfunction pageDataFileExists(programDir, pagePath) {\n  return fs.existsSync(path.join(programDir, 'public', 'page-data', pagePath, 'page-data.json'))\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await readPageData(pagePath)\n} catch (err) {\n  if (/Query was not run/.test(err.message)) {\n    // rebuild page-data before retrying\n    throw err\n  }\n  throw err\n}","preventionTips":["Run gatsby develop/build fully before serving page-data requests.","Clear .cache and public after upgrades or plugin changes.","Watch the build log for silent query-extraction failures."],"tags":["page-data","cache","filesystem"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}