gatsbyjs/gatsby · error

You did not pass in a valid serialize function. Your feed wi

Error message

You did not pass in a valid serialize function. Your feed will not be generated.

What it means

Feed-generation guard in gatsby-plugin-feed's onPostBuild: the current feed entry has no `serialize` option or it is not a function, so the plugin cannot convert query results into RSS items and skips generating that feed entirely. Other feeds in the `feeds` array still process.

Source

Thrown at packages/gatsby-plugin-feed/src/gatsby-node.js:38

    ...pluginOptions,
  }

  const baseQuery = await runQuery(graphql, options.query)

  for (const { ...feed } of options.feeds) {
    if (feed.query) {
      feed.query = await runQuery(graphql, feed.query).then(result =>
        merge({}, baseQuery, result)
      )
    }

    const { setup, ...locals } = {
      ...options,
      ...feed,
    }

    if (!feed.serialize || typeof feed.serialize !== `function`) {
      reporter.warn(
        `You did not pass in a valid serialize function. Your feed will not be generated.`
      )
    } else {
      const rssFeed = (await feed.serialize(locals)).reduce((merged, item) => {
        merged.item(item)
        return merged
      }, new RSS(setup(locals)))

      const outputPath = path.join(publicPath, feed.output)
      const outputDir = path.dirname(outputPath)
      if (!(await fs.pathExists(outputDir))) {
        await fs.mkdirp(outputDir)
      }
      await fs.writeFile(outputPath, rssFeed.xml())
    }
  }
}

View on GitHub (pinned to e85d62f177)

Solutions

  1. Pass a valid serialize function in the feed's options (see gatsby-plugin-feed docs)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/gatsby-plugin-feed/src/gatsby-node.js:38 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/892ba73561e944e5. Report an issue: GitHub.