{"record":{"id":"2ecdd6c236c2bcba","repo":"gatsbyjs/gatsby","slug":"specifying-both-jpg-and-png-formats-is-not-sup","errorCode":null,"errorMessage":"Specifying both \"jpg\" and \"png\" formats is not supported and will be ignored. Please use \"auto\" instead.","messagePattern":"Specifying both \"jpg\" and \"png\" formats is not supported and will be ignored\\. Please use \"auto\" instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-sharp/src/image-data.ts","lineNumber":205,"sourceCode":"  }\n\n  if (args.aspectRatio) {\n    if (args.width && args.height) {\n      reporter.warn(\n        `Specifying aspectRatio along with both width and height will cause aspectRatio to be ignored.`\n      )\n    } else if (args.width) {\n      args.height = args.width / args.aspectRatio\n    } else if (args.height) {\n      args.width = args.height * args.aspectRatio\n    }\n  }\n\n  const formats = new Set(args.formats)\n  let useAuto = formats.has(``) || formats.has(`auto`) || formats.size === 0\n\n  if (formats.has(`jpg`) && formats.has(`png`)) {\n    reporter.warn(\n      `Specifying both \"jpg\" and \"png\" formats is not supported and will be ignored. Please use \"auto\" instead.`\n    )\n    useAuto = true\n  }\n\n  let primaryFormat: ImageFormat | undefined\n  if (useAuto) {\n    primaryFormat = normalizeFormat(metadata?.format || file.extension)\n  } else if (formats.has(`png`)) {\n    primaryFormat = `png`\n  } else if (formats.has(`jpg`)) {\n    primaryFormat = `jpg`\n  } else if (formats.has(`webp`)) {\n    primaryFormat = `webp`\n  } else if (formats.has(`avif`)) {\n    reporter.warn(\n      `Image ${file.relativePath} specified only AVIF format, with no fallback format. This will mean your site cannot be viewed in all browsers.`\n    )","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-plugin-sharp/src/image-data.ts#L187-L223","documentation":"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.","triggerScenarios":"Thrown at packages/gatsby-plugin-sharp/src/image-data.ts:205 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep only one of jpg/png in formats or use \"auto\""],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}