{"record":{"id":"374ac4730a40934e","repo":"gatsbyjs/gatsby","slug":"couldn-t-get-query-results-for-pagepath-in","errorCode":null,"errorMessage":"Couldn't get query results for \"${pagePath}\" in ${(initialWaitForMs / 1000).toFixed(3)}s.","messagePattern":"Couldn't get query results for \"(.+?)\" in (.+?)s\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/get-page-data.ts","lineNumber":100,"sourceCode":"          // callback in same tick and `mett` will run this callback (because it will happen before current callback finishes\n          // and `mett` doesn't guarantee it will only run callbacks registered before message was emitted)\n          process.nextTick(() =>\n            resolve(\n              doGetPageData(\n                pagePath,\n                Math.max(remainingTime - RETRY_INTERVAL / 5, 0),\n                initialWaitForMs\n              )\n            )\n          )\n        }\n      }\n    })\n  } else {\n    // not ideal ... but try to push results we might have (stale)\n    // or fail/reject\n    return readPageData(pagePath).catch(() => {\n      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(","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/utils/get-page-data.ts#L82-L118","documentation":"After waiting initialWaitForMs (default 15s) for the page query to finish running and for page-data to flush, results are still unavailable, and the fallback stale read from disk also failed; Gatsby gives up and throws with the elapsed seconds.","triggerScenarios":"A page query that runs longer than the wait budget; the query runner stalled; dev server under heavy load; circular dependencies between queries.","commonSituations":"Heavy page queries on large datasets; worker pool exhaustion; slow plugins; very large images; machine under load.","solutions":["Increase the wait budget (pass a larger waitForMS to getPageData).","Optimize the page query (narrow filters, paginate, reduce node volume).","Inspect running query jobs for stuck workers; restart the dev server.","Reduce data volume or split the page into slices."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pass a larger wait budget for known-slow pages\nconst data = await getPageData(pagePath, 60_000 /* ms */)","typeGuard":null,"tryCatchPattern":"try {\n  return await getPageData(pagePath, waitForMS)\n} catch (err) {\n  if (/Couldn't get query results/.test(err.message)) {\n    // log, optimize the query, and surface a meaningful error to the user\n    throw new Error(`Page query timed out for ${pagePath}; optimize or increase waitForMS`)\n  }\n  throw err\n}","preventionTips":["Profile slow page queries and narrow filters / paginate large result sets.","Pass an explicit, larger waitForMS for pages known to be heavy.","Monitor query-runner worker pool saturation under load."],"tags":["page-data","timeout","query-runner"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}