gatsbyjs/gatsby · error
[gatsby-source-drupal] Encountered corrupt file while reques
Error message
[gatsby-source-drupal] Encountered corrupt file while requesting image dimensions for ${url} What it means
In getGatsbyImageCdnFields, the remote file downloads but image-dimension parsing fails with 'unrecognized file format', meaning the URL points to a corrupt file or a non-image served with an image role. The plugin warns (capped at 10 per build) and returns empty Image CDN fields; the file is treated as having no usable image data.
Source
Thrown at packages/gatsby-source-drupal/src/normalize.ts:118
height: imageSize.height,
mimeType,
}
return gatsbyImageCdnFields
} catch (e) {
if (e.message.includes(`404`)) {
if (four04WarningCount < 10) {
four04WarningCount++
reporter.warn(`[gatsby-source-drupal] file returns 404: ${url}`)
}
return {}
}
if (e.message.includes(`unrecognized file format`)) {
if (corruptFileWarningCount < 10) {
corruptFileWarningCount++
reporter.warn(
`[gatsby-source-drupal] Encountered corrupt file while requesting image dimensions for ${url}`
)
}
return {}
}
reporter.error(e)
reporter.info(
JSON.stringify(
{
extraNodeData,
url,
attributes: node.attributes,
},
null,
2
)View on GitHub (pinned to e85d62f177)
Solutions
- Re-upload the file in Drupal to replace the corrupt asset.
- Verify the file is actually a valid image (open it or run file/identify on the URL).
- Ensure the Drupal view/response serving the placeholder isn't returning an HTML error page or wrong content type.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/gatsby-source-drupal/src/normalize.ts:118 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/a660f1348efad771.
Report an issue: GitHub.