gatsbyjs/gatsby · error
Specifying both "jpg" and "png" formats is not supported and
Error message
Specifying both "jpg" and "png" formats is not supported and will be ignored. Please use "auto" instead.
What it means
Format-validation warning inside generateImageData (gatsby-plugin-sharp): args.formats contains both 'jpg' and 'png', which the generator cannot produce in one pass. The code sets useAuto = true, so it falls back to the source image's native format via 'auto' handling.
Source
Thrown at packages/gatsby-plugin-sharp/src/image-data.ts:205
}
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
}
let primaryFormat: ImageFormat | undefined
if (useAuto) {
primaryFormat = normalizeFormat(metadata?.format || file.extension)
} else if (formats.has(`png`)) {
primaryFormat = `png`
} else if (formats.has(`jpg`)) {
primaryFormat = `jpg`
} else if (formats.has(`webp`)) {
primaryFormat = `webp`
} else if (formats.has(`avif`)) {
reporter.warn(
`Image ${file.relativePath} specified only AVIF format, with no fallback format. This will mean your site cannot be viewed in all browsers.`
)View on GitHub (pinned to e85d62f177)
Solutions
- Keep only one of jpg/png in formats or use "auto"
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/gatsby-plugin-sharp/src/image-data.ts:205 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/2ecdd6c236c2bcba.
Report an issue: GitHub.