{"record":{"id":"8e62d5216e2caa7e","repo":"gatsbyjs/gatsby","slug":"invalid-plugin-options-for-gatsby-plugin-feed-8e62d5","errorCode":null,"errorMessage":"Invalid plugin options for \"gatsby-plugin-feed\":\n        \"query\" must be a valid GraphQL query. Received the error \"${e.message}\"","messagePattern":"Invalid plugin options for \"gatsby-plugin-feed\":\n        \"query\" must be a valid GraphQL query\\. Received the error \"(.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-feed/src/plugin-options.js","lineNumber":41,"sourceCode":"          )\n        }\n      }\n    })\n\nexport default ({ Joi }) =>\n  Joi.object({\n    generator: Joi.string(),\n    query: Joi.string(),\n    setup: Joi.func(),\n    feeds: Joi.array().items(feed({ Joi })).required(),\n  })\n    .unknown(true)\n    .external(({ query }) => {\n      if (query) {\n        try {\n          parse(query)\n        } catch (e) {\n          throw new Error(\n            stripIndent`\n        Invalid plugin options for \"gatsby-plugin-feed\":\n        \"query\" must be a valid GraphQL query. Received the error \"${e.message}\"`\n          )\n        }\n      }\n    })\n","sourceCodeStart":23,"sourceCodeEnd":49,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-feed/src/plugin-options.js#L23-L49","documentation":"Thrown by the top-level Joi external validator in gatsby-plugin-feed's plugin-options when the plugin's main `query` option fails graphql parse. Identical mechanism to the per-feed validator but operates on the root query option passed to the plugin itself, so it fires before any feed-level validation.","triggerScenarios":"Passing `query` to the gatsby-plugin-feed options object (the shared site-level query) that is not valid GraphQL syntax; setting options.query to an empty or partial string; the default query being overridden with a malformed one.","commonSituations":"Overriding the plugin's top-level query with a broken template; partial copy-paste from the docs missing closing braces; upgrading gatsby-plugin-feed and forgetting to update a customized query.","solutions":["Open the message — it embeds the graphql parse error message pinpointing the token.","Validate the top-level query string in GraphiQL.","If unsure, remove the custom `query` option to restore the default valid query.","Ensure no un-interpolated template placeholders remain in the string."],"exampleFix":"// before\n{ resolve: 'gatsby-plugin-feed', options: { query: `{ site { siteMetadata { title `, feeds } }\n// after\n{ resolve: 'gatsby-plugin-feed', options: { query: `{ site { siteMetadata { title } } }`, feeds } }","handlingStrategy":"validation","validationCode":"const { parse } = require('graphql')\ntry { parse(options.query) } catch (e) { console.error(`Top-level plugin-feed query invalid: ${e.message}`) }","typeGuard":"const isParseableGraphQL = (q: string): boolean => { try { parse(q); return true } catch { return false } }","tryCatchPattern":null,"preventionTips":["Validate the top-level plugin-feed query in GraphiQL.","Omit a custom `query` to use the default valid query.","Avoid template-literal placeholders in the query."],"tags":["graphql","gatsby-plugin-feed","plugin-options","validation"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}