gatsbyjs/gatsby · error
[gatsby-plugin-image] Could not read image data file "${file
Error message
[gatsby-plugin-image] 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. What it means
Error "[gatsby-plugin-image] 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." thrown in gatsbyjs/gatsby.
Source
Thrown at packages/gatsby-plugin-image/src/babel-plugin-parse-static-images.ts:80
`[gatsby-plugin-image] Couldn't find image data cache file`
)
}
const filename = path.join(cacheDir, `${hash}.json`)
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)View on GitHub (pinned to e85d62f177)
Solutions
- Upgrade Gatsby to at least 2.24.78 so image data files are written
- Run `gatsby clean` to clear stale caches and rebuild
- Verify the images in the file were processed during the node phase
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/gatsby-plugin-image/src/babel-plugin-parse-static-images.ts:80 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/945cf64496e7b790.
Report an issue: GitHub.