gatsbyjs/gatsby · error
Your GraphQL query in createPages took ${totalMS / 1000} sec
Error message
Your GraphQL query in createPages took ${totalMS / 1000} seconds which is an unexpectedly long time. See https://gatsby.dev/create-pages-performance for tips on how to improve this. What it means
Error "Your GraphQL query in createPages took ${totalMS / 1000} seconds which is an unexpectedly long time. See https://gatsby.dev/create-pages-performance for tips on how to improve this." thrown in gatsbyjs/gatsby.
Source
Thrown at packages/gatsby/src/services/create-pages.ts:40
assertStore(store)
const activity = reporter.activityTimer(`createPages`, {
parentSpan,
})
activity.start()
const timestamp = Date.now()
const currentPages = new Map<string, IGatsbyPage>(store.getState().pages)
// Wrap the GraphQL function so we can measure how long it takes to run.
const originalGraphQL = gatsbyNodeGraphQLFunction
// eslint-disable-next-line
async function wrappedGraphQL() {
const start = Date.now()
// @ts-ignore not sure how to type the following
const returnValue = await originalGraphQL.apply(this, arguments) // eslint-disable-line
const end = Date.now()
const totalMS = end - start
if (totalMS > 10000) {
reporter.warn(
`Your GraphQL query in createPages took ${
totalMS / 1000
} seconds which is an unexpectedly long time. See https://gatsby.dev/create-pages-performance for tips on how to improve this.`
)
}
return returnValue
}
createPagesCount += 1
const traceId = isInitialCreatePages
? `initial-createPages`
: `createPages #${createPagesCount}`
await apiRunnerNode(
`createPages`,
{
graphql: wrappedGraphQL,
traceId,
waitForCascadingActions: true,View on GitHub (pinned to e85d62f177)
Solutions
- Follow https://gatsby.dev/create-pages-performance: reduce the amount of data queried in createPages
- Paginate or filter queries instead of fetching all nodes at once
- Move expensive work out of createPages into onPreBuild or async work outside the critical path
- Profile the wrappedGraphQL timing to find the specific slow query in gatsby-node.js
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/gatsby/src/services/create-pages.ts:40 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26).
Data as JSON: /api/errors/a8056881f78af9d3.
Report an issue: GitHub.