{"record":{"id":"5e07baf3c4727ce4","repo":"gatsbyjs/gatsby","slug":"r-errors-join","errorCode":null,"errorMessage":"${r.errors.join(`, `)}","messagePattern":"\\$\\{r\\.errors\\.join\\(`, `\\)\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-feed/src/internals.js","lineNumber":4,"sourceCode":"export const runQuery = (handler, query) =>\n  handler(query).then(r => {\n    if (r.errors) {\n      throw new Error(r.errors.join(`, `))\n    }\n\n    return r.data\n  })\n\nexport const defaultOptions = {\n  // Override if you want to manually specify the RSS \"generator\" tag.\n  generator: `GatsbyJS`,\n\n  // Run a default query to gather some information about the site.\n  query: `\n    {\n      site {\n        siteMetadata {\n          title\n          description\n          siteUrl\n          site_url: siteUrl","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-feed/src/internals.js#L1-L22","documentation":"Thrown by gatsby-plugin-feed's runQuery helper when the GraphQL handler returns a response with a non-empty `errors` array. The helper joins all error strings into one message and throws, aborting feed generation for that query. It is the runtime counterpart to the plugin-options validation: a structurally valid query that the schema rejects at execution time.","triggerScenarios":"Calling runQuery(handler, query) where the GraphQL execution returns { errors: [...] } — typically field does not exist, type mismatch, missing resolver, or unauthorized field on the site's schema. Happens during onPostBootstrap when the feed's default or custom query runs against the built schema.","commonSituations":"Customizing plugin-feed's `query` option to a field that does not exist on the user's schema; removing/renaming a sourced field that the feed query selects; version mismatch where siteAllPage/sitePage fields changed; a typo in a fragment name.","solutions":["Read the joined error string — it names the failing field/type.","Run the same query in GraphiQL (`gatsby develop`) to reproduce and see full error locations.","Align the feed query (or the `setup`/`feeds[].serialize`) with the current schema; rename removed fields.","If using a custom query, verify every selected field resolves against your sourced nodes."],"exampleFix":"// before: query selects a field that no longer exists\nquery: `{ allSitePage { totalCount } }`\n// after: select an existing field\nquery: `{ allMarkdownRemark { totalCount } }`","handlingStrategy":"try-catch","validationCode":"// dry-run the feed query against the schema before onPostBootstrap\nconst res = await runQuery(graphql, feedQuery)\nif (!res) console.warn('feed query returned no data')","typeGuard":"const isErrorsResponse = (r: any): r is { errors: any[] } =>\n  !!r && Array.isArray(r.errors) && r.errors.length > 0","tryCatchPattern":"try {\n  const data = await runQuery(handler, query)\n} catch (e) {\n  if (/errors/i.test(e.message)) { /* fix schema/query, skip feed */ } else throw e\n}","preventionTips":["Run feed queries in GraphiQL before enabling the plugin.","Keep feed queries in sync when renaming sourced fields.","Pin field selections to stable schema fields."],"tags":["graphql","gatsby-plugin-feed","plugin-options","runtime"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}