gatsbyjs/gatsby · error
Invalid plugin options for "gatsby-plugin-feed": "qu
Error message
Invalid plugin options for "gatsby-plugin-feed":
"query" must be a valid GraphQL query. Received the error "${e.message}" What it means
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.
Source
Thrown at packages/gatsby-plugin-feed/src/plugin-options.js:41
)
}
}
})
export default ({ Joi }) =>
Joi.object({
generator: Joi.string(),
query: Joi.string(),
setup: Joi.func(),
feeds: Joi.array().items(feed({ Joi })).required(),
})
.unknown(true)
.external(({ query }) => {
if (query) {
try {
parse(query)
} catch (e) {
throw new Error(
stripIndent`
Invalid plugin options for "gatsby-plugin-feed":
"query" must be a valid GraphQL query. Received the error "${e.message}"`
)
}
}
})
View on GitHub (pinned to 8b06340921)
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.
Example fix
// before
{ resolve: 'gatsby-plugin-feed', options: { query: `{ site { siteMetadata { title `, feeds } }
// after
{ resolve: 'gatsby-plugin-feed', options: { query: `{ site { siteMetadata { title } } }`, feeds } } Defensive patterns
Strategy: validation
Validate before calling
const { parse } = require('graphql')
try { parse(options.query) } catch (e) { console.error(`Top-level plugin-feed query invalid: ${e.message}`) } Type guard
const isParseableGraphQL = (q: string): boolean => { try { parse(q); return true } catch { return false } } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid plugin options for "gatsby-plugin-feed": "quer
- ${r.errors.join(`, `)}
- PageCreator: To query node "gatsbyPath" the "filePath" argum
- PageCreator: To query node "gatsbyPath" the "filePath" argum
- PageCreator: To query node "gatsbyPath" the "filePath" argum
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/8e62d5216e2caa7e.
Report an issue: GitHub.