gatsbyjs/gatsby · error
Specifying aspectRatio along with both width and height will
Error message
Specifying aspectRatio along with both width and height will cause aspectRatio to be ignored.
What it means
Argument-sanity warning inside generateImageData (gatsby-plugin-sharp): the caller supplied aspectRatio together with both width and height. Since width+height already fully determine the output size, the aspectRatio value cannot be applied and is ignored; the warning fires before the width/height are finalized from metadata.
Source
Thrown at packages/gatsby-plugin-sharp/src/image-data.ts:191
placeholder === `dominantColor`,
cache
)
if ((args.width || args.height) && layout === `fullWidth`) {
reporter.warn(
`Specifying fullWidth images will ignore the width and height arguments, you may want a constrained image instead. Otherwise, use the breakpoints argument.`
)
args.width = metadata?.width
args.height = undefined
}
if (!args.width && !args.height && metadata.width) {
args.width = metadata.width
}
if (args.aspectRatio) {
if (args.width && args.height) {
reporter.warn(
`Specifying aspectRatio along with both width and height will cause aspectRatio to be ignored.`
)
} else if (args.width) {
args.height = args.width / args.aspectRatio
} else if (args.height) {
args.width = args.height * args.aspectRatio
}
}
const formats = new Set(args.formats)
let useAuto = formats.has(``) || formats.has(`auto`) || formats.size === 0
if (formats.has(`jpg`) && formats.has(`png`)) {
reporter.warn(
`Specifying both "jpg" and "png" formats is not supported and will be ignored. Please use "auto" instead.`
)
useAuto = true
}View on GitHub (pinned to e85d62f177)
Solutions
- Pass only one of width/height alongside aspectRatio, or drop aspectRatio
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/gatsby-plugin-sharp/src/image-data.ts:191 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/e1484917ed548cbb.
Report an issue: GitHub.