{"record":{"id":"50c97a407c232c32","repo":"gatsbyjs/gatsby","slug":"invalid-plugin-options-for-gatsby-plugin-sitemap-50c97a","errorCode":null,"errorMessage":"Invalid plugin options for \"gatsby-plugin-sitemap\":\n\"query\" must be a valid GraphQL query. Received the error \"${e.message}\"","messagePattern":"Invalid plugin options for \"gatsby-plugin-sitemap\":\n\"query\" must be a valid GraphQL query\\. Received the error \"(.+?)\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-sitemap/src/options-validation.js","lineNumber":50,"sourceCode":"            siteMetadata {\n              siteUrl\n            }\n          }\n\n          allSitePage {\n            nodes {\n              path\n            }\n          }\n        }`\n      )\n      .external(pluginOptions => {\n        const query = pluginOptions?.query\n        if (query) {\n          try {\n            parseGraphql(query)\n          } catch (e) {\n            throw new Error(\n              stripIndent`\n        Invalid plugin options for \"gatsby-plugin-sitemap\":\n        \"query\" must be a valid GraphQL query. Received the error \"${e.message}\"`\n            )\n          }\n        }\n      })\n      .description(\n        stripIndent`\n        (GraphQL Query) The query for the data you need to generate the sitemap.\n        It's required to get the site's URL, if you are not fetching it from \\`site.siteMetadata.siteUrl\\`,\n        you will need to set a custom \\`resolveSiteUrl\\` function.\n        If you override the query, you may need to pass in a custom \\`resolvePagePath\\` or\n        \\`resolvePages\\` to keep everything working.\n        If you fetch pages without using \\`allSitePage.nodes\\` query structure\n        you will definately need to customize the \\`resolvePages\\` function.`\n      ),\n    excludes: Joi.array()","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-plugin-sitemap/src/options-validation.js#L32-L68","documentation":"Options validation for gatsby-plugin-sitemap: the user-supplied query string fails graphql parse in the .external() check of the Joi schema. The error names the parser failure, so the sitemap query in gatsby-config is invalid GraphQL.","triggerScenarios":"Thrown at packages/gatsby-plugin-sitemap/src/options-validation.js:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the GraphQL syntax of the sitemap plugin's query option","Test the query in GraphiQL before putting it in gatsby-config","Omit query to use the default sitemap query"],"exampleFix":null,"handlingStrategy":"validation","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"}