{"record":{"id":"aec44a288698d84f","repo":"gatsbyjs/gatsby","slug":"error-executing-the-graphql-query-inside-gatsby-pl-aec44a","errorCode":null,"errorMessage":"Error executing the GraphQL query inside gatsby-plugin-sitemap:\n","messagePattern":"Error executing the GraphQL query inside gatsby-plugin-sitemap:\n","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-sitemap/src/gatsby-node.js","lineNumber":30,"sourceCode":"    entryLimit,\n    query,\n    excludes,\n    resolveSiteUrl,\n    resolvePagePath,\n    resolvePages,\n    filterPages,\n    serialize,\n  }\n) => {\n  const { data: queryRecords, errors } = await graphql(query)\n\n  // resolvePages and resolveSiteUrl are allowed to be sync or async. The Promise.resolve handles each possibility\n  const siteUrl = await Promise.resolve(resolveSiteUrl(queryRecords)).catch(\n    err => reporter.panic(`${REPORTER_PREFIX} Error resolving Site URL`, err)\n  )\n\n  if (errors) {\n    reporter.panic(\n      `Error executing the GraphQL query inside gatsby-plugin-sitemap:\\n`,\n      errors\n    )\n  }\n\n  const allPages = await Promise.resolve(resolvePages(queryRecords)).catch(\n    err => reporter.panic(`${REPORTER_PREFIX} Error resolving Pages`, err)\n  )\n\n  if (!Array.isArray(allPages)) {\n    reporter.panic(\n      `${REPORTER_PREFIX} The \\`resolvePages\\` function did not return an array.`\n    )\n  }\n\n  reporter.verbose(\n    `${REPORTER_PREFIX} Filtering ${allPages.length} pages based on ${excludes.length} excludes`\n  )","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-plugin-sitemap/src/gatsby-node.js#L12-L48","documentation":"gatsby-plugin-sitemap's onPostBuild runs the configured GraphQL query; a non-empty errors array from the graphql call means the site query failed (schema mismatch, syntax error, missing siteUrl data). The whole errors array is attached to the panic.","triggerScenarios":"Thrown at packages/gatsby-plugin-sitemap/src/gatsby-node.js:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the GraphQL error shown in the errors array","Ensure siteMetadata.siteUrl is set","Restore/keep the required allSitePage fields if the query was customized"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}