{"record":{"id":"e1484917ed548cbb","repo":"gatsbyjs/gatsby","slug":"specifying-aspectratio-along-with-both-width-and-h","errorCode":null,"errorMessage":"Specifying aspectRatio along with both width and height will cause aspectRatio to be ignored.","messagePattern":"Specifying aspectRatio along with both width and height will cause aspectRatio to be ignored\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-sharp/src/image-data.ts","lineNumber":191,"sourceCode":"    placeholder === `dominantColor`,\n    cache\n  )\n\n  if ((args.width || args.height) && layout === `fullWidth`) {\n    reporter.warn(\n      `Specifying fullWidth images will ignore the width and height arguments, you may want a constrained image instead. Otherwise, use the breakpoints argument.`\n    )\n    args.width = metadata?.width\n    args.height = undefined\n  }\n\n  if (!args.width && !args.height && metadata.width) {\n    args.width = metadata.width\n  }\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  }","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-plugin-sharp/src/image-data.ts#L173-L209","documentation":"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.","triggerScenarios":"Thrown at packages/gatsby-plugin-sharp/src/image-data.ts:191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass only one of width/height alongside aspectRatio, or drop aspectRatio"],"exampleFix":null,"handlingStrategy":"validation","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-14T05:17:10.506Z"}