gatsbyjs/gatsby · error

[gatsby-plugin-image] No data found for image

Error message

[gatsby-plugin-image] No data found for image "${props.src}"

What it means

Babel-transform guard in gatsby-plugin-image's static-image parser: the image data JSON file produced during build could not be read for the <StaticImage src="..."> being compiled. This sentinel warning (with a follow-up error about the data file) means the build did not process that component's images — typically on Gatsby versions older than 2.24.78 — and the src prop will fail to resolve at runtime.

Solutions

  1. Verify the src path is correct and points at a real image
  2. Rebuild with a clean cache so image data is regenerated
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/gatsby-plugin-image/src/babel-plugin-parse-static-images.ts:85 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/8dbd6528acb4cdc5. Report an issue: GitHub.

Appendix: source

Thrown at packages/gatsby-plugin-image/src/babel-plugin-parse-static-images.ts:85

        let data: Record<string, unknown> | undefined

        // If there's no src prop there's no point in checking if it exists
        if (!unresolvedProps.includes(`src`)) {
          try {
            data = fs.readJSONSync(filename)
          } catch (e) {
            // TODO add info about minimum Gatsby version once this is merged
            const msg = stripIndent`
            Could not read image data file "${filename}". 
            This may mean that the images in "${this.filename}" were not processed.
            Please ensure that your gatsby version is at least 2.24.78.`
            error += msg
            console.warn(`[gatsby-plugin-image] ${msg}`)
          }
        }

        if (!data) {
          console.warn(
            `[gatsby-plugin-image] No data found for image "${props.src}"`
          )

          // Add the error message to the component so we can show it in the browser
          const newProp = t.jsxAttribute(
            t.jsxIdentifier(`__error`),

            t.jsxExpressionContainer(
              t.stringLiteral(`No data found for image "${props.src}"
              ${error || ``}`)
            )
          )
          nodePath.node.attributes.push(newProp)
          return
        }
        if (error) {
          // Add the error message to the component so we can show it in the browser

View on GitHub (pinned to e85d62f177)