gatsbyjs/gatsby · error

[${pluginName}] The resolver for image ${filename} returned

Error message

[${pluginName}] The resolver for image ${filename} returned an invalid value.

What it means

Per-size guard inside generateImageData: for the current format/size, the source plugin's generateImageSource callback returned an object missing width, height, src or format (or undefined). That size is dropped (undefined) from the generated srcSet; other sizes still build. It indicates a bug or unsupported input in the calling image source plugin.

Source

Thrown at packages/gatsby-plugin-image/src/image-utils.ts:306

  formats.forEach(format => {
    const images = imageSizes.sizes
      .map(size => {
        const imageSrc = generateImageSource(
          filename,
          size,
          Math.round(size / imageSizes.aspectRatio),
          format,
          fit,
          options
        )
        if (
          !imageSrc?.width ||
          !imageSrc.height ||
          !imageSrc.src ||
          !imageSrc.format
        ) {
          reporter.warn(
            `[${pluginName}] The resolver for image ${filename} returned an invalid value.`
          )
          return undefined
        }
        return imageSrc
      })
      .filter(Boolean)

    if (format === `jpg` || format === `png` || format === `auto`) {
      const unscaled =
        images.find(img => img.width === imageSizes.unscaledWidth) || images[0]

      if (unscaled) {
        result.fallback = {
          src: unscaled.src,
          srcSet: getSrcSet(images),
          sizes,
        }

View on GitHub (pinned to e85d62f177)

Solutions

  1. Fix the source plugin's generateImageSource to return {src, width, height, format} for every requested size
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/gatsby-plugin-image/src/image-utils.ts:306 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/817be7d1490a276b. Report an issue: GitHub.