gatsbyjs/gatsby · error

[gatsby-plugin-image] Could not find values for the followin

Error message

[gatsby-plugin-image] Could not find values for the following props at build time: ${unresolvedProps.join(`, `)}

What it means

Babel-macro-time warning from the StaticImage plugin: evaluateImageAttributes could not statically resolve the listed props because they are dynamic expressions or variables. StaticImage requires literal prop values so images can be located and processed at build time.

Source

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

            .referencesImport(`gatsby-plugin-image`, `StaticImage`)
        ) {
          return
        }

        const unresolvedProps: Array<string> = []

        const props = evaluateImageAttributes(nodePath, prop => {
          unresolvedProps.push(prop)
        })

        let error

        if (unresolvedProps.length) {
          // TODO: Add a shortlink to docs on the plugin
          error = `Could not find values for the following props at build time: ${unresolvedProps.join(
            `, `
          )}`
          console.warn(`[gatsby-plugin-image] ${error}`)
        }

        // Adding the filename to the hashing, like in "extractStaticImageProps" function
        if (state.filename) {
          props.filename = slash(state.filename)
        }
        const hash = hashOptions(props)

        const cacheDir = (this.opts as Record<string, string>)?.cacheDir

        if (!cacheDir) {
          console.warn(
            `[gatsby-plugin-image] Couldn't find image data cache file`
          )
        }

        const filename = path.join(cacheDir, `${hash}.json`)
        let data: Record<string, unknown> | undefined

View on GitHub (pinned to e85d62f177)

Solutions

  1. Pass the listed props as static string/number literals directly in the StaticImage JSX
  2. Do not compute props from variables, function calls or template expressions
Defensive patterns

Strategy: validation

When it happens

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