{"record":{"id":"32817b4dee996b5f","repo":"gatsbyjs/gatsby","slug":"invalid-plugin-options-for-gatsby-plugin-feed","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":19,"sourceCode":"import { parse } from \"gatsby/graphql\"\nimport { stripIndent } from \"common-tags\"\n\nconst feed = ({ Joi }) =>\n  Joi.object({\n    output: Joi.string().required(),\n    query: Joi.string().required(),\n    title: Joi.string().required(),\n    serialize: Joi.func().required(),\n    match: Joi.string(),\n    link: Joi.string(),\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\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) {","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-feed/src/plugin-options.js#L1-L37","documentation":"Thrown by the per-feed Joi external validator in gatsby-plugin-feed's plugin-options when an individual feed's `query` string fails graphql parse. It is a config-time error fired during plugin option validation, distinct from the runtime runQuery error — it catches malformed query syntax before any execution.","triggerScenarios":"Defining a feed in the `feeds` array whose `query` string is not parseable GraphQL (unclosed brace, invalid token, stray interpolation); calling setPluginOptions with such a feed config. The validator runs `parse(query)` inside the Joi .external hook.","commonSituations":"Writing a custom feed query with a syntax typo; copying a query template that left a placeholder like ${var} un-interpolated; mixing tabs/odd quotes; upgrading the graphql parser to a stricter version.","solutions":["Paste the feed's `query` into GraphiQL to find the syntax error.","Remove any JS interpolation from the query string literal.","Confirm the query is a complete, balanced GraphQL operation.","Re-run `gatsby develop` — config validation fires early and will name the error from the message."],"exampleFix":"// before\nfeeds: [{ query: `{ allMarkdownRemark { edges { node { id } } `, serialize: f }]\n// after\nfeeds: [{ query: `{ allMarkdownRemark { edges { node { id } } } }`, serialize: f }]","handlingStrategy":"validation","validationCode":"const { parse } = require('graphql')\nfeeds.forEach(f => { try { parse(f.query) } catch (e) { console.error(`Feed query invalid: ${e.message}`) } })","typeGuard":"const isParseableGraphQL = (q: string): boolean => { try { parse(q); return true } catch { return false } }","tryCatchPattern":null,"preventionTips":["Validate every feed query string in GraphiQL before configuring.","Never interpolate values into the query string.","Use the default query when in doubt."],"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"}