gatsbyjs/gatsby · error
Couldn't get query results for "${pagePath}" in ${(initialWa
Error message
Couldn't get query results for "${pagePath}" in ${(initialWaitForMs / 1000).toFixed(3)}s. What it means
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.
Source
Thrown at packages/gatsby/src/utils/get-page-data.ts:100
// callback in same tick and `mett` will run this callback (because it will happen before current callback finishes
// and `mett` doesn't guarantee it will only run callbacks registered before message was emitted)
process.nextTick(() =>
resolve(
doGetPageData(
pagePath,
Math.max(remainingTime - RETRY_INTERVAL / 5, 0),
initialWaitForMs
)
)
)
}
}
})
} else {
// not ideal ... but try to push results we might have (stale)
// or fail/reject
return readPageData(pagePath).catch(() => {
throw new Error(
`Couldn't get query results for "${pagePath}" in ${(
initialWaitForMs / 1000
).toFixed(3)}s.`
)
})
}
}
async function readPageData(pagePath): Promise<IPageDataWithQueryResult> {
const { program } = store.getState()
try {
return await readPageDataUtil(
path.join(program.directory, `public`),
pagePath
)
} catch (err) {
throw new Error(View on GitHub (pinned to 8b06340921)
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.
Defensive patterns
Strategy: retry
Validate before calling
// Pass a larger wait budget for known-slow pages const data = await getPageData(pagePath, 60_000 /* ms */)
Try / catch
try {
return await getPageData(pagePath, waitForMS)
} catch (err) {
if (/Couldn't get query results/.test(err.message)) {
// log, optimize the query, and surface a meaningful error to the user
throw new Error(`Page query timed out for ${pagePath}; optimize or increase waitForMS`)
}
throw err
} Prevention
- 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.
When it happens
Trigger: A page query that runs longer than the wait budget; the query runner stalled; dev server under heavy load; circular dependencies between queries.
Common situations: Heavy page queries on large datasets; worker pool exhaustion; slow plugins; very large images; machine under load.
Related errors
- Could not find query ${pagePath}
- Page "${pagePath}" doesn't exist. It might have been deleted
- Error loading a result for the page query in "${pagePath}".
- Couldn't find temp query result for "${pagePath}".
- Page for "${pathName}" not found
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/374ac4730a40934e.
Report an issue: GitHub.