{"record":{"id":"56dc7325df98c59d","repo":"gatsbyjs/gatsby","slug":"either-the-width-or-height-argument-is","errorCode":null,"errorMessage":"\n      Either the \"width\" or \"height\" argument is required for \"${source.url}\"","messagePattern":"\n      Either the \"width\" or \"height\" argument is required for \"(.+?)\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-utils/src/polyfill-remote-file/graphql/gatsby-image-resolver.ts","lineNumber":102,"sourceCode":"  store?: Store\n): Promise<{\n  images: IGatsbyImageData\n  layout: string\n  width: number\n  height: number\n  backgroundColor?: string\n  placeholder?: { fallback: string } | undefined\n} | null> {\n  if (!isImage(source)) {\n    return null\n  }\n\n  if (!args.layout) {\n    throw new Error(`The \"layout\" argument is required for \"${source.url}\"`)\n  }\n\n  if (!args.width && !args.height) {\n    throw new Error(`\n      Either the \"width\" or \"height\" argument is required for \"${source.url}\"\n    `)\n  }\n\n  if (!args.formats) {\n    args.formats = [`auto`, `webp`, `avif`]\n  }\n\n  if (!args.outputPixelDensities) {\n    args.outputPixelDensities = DEFAULT_PIXEL_DENSITIES\n  }\n\n  if (!args.breakpoints) {\n    args.breakpoints = DEFAULT_BREAKPOINTS\n  }\n\n  if (!args.fit) {\n    args.fit = `cover`","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-utils/src/polyfill-remote-file/graphql/gatsby-image-resolver.ts#L84-L120","documentation":"Thrown by the polyfill-remote-file gatsby-image resolver when neither `width` nor `height` is provided for an image transformation. At least one dimension is required to compute aspect-ratio-aware sizes and generate properly sized images.","triggerScenarios":"args.width and args.height are both falsy when the resolver runs; the layout check passed but no dimension was supplied.","commonSituations":"A GraphQL query or programmatic call provides layout but omits both width and height, expecting a default that the resolver does not assume.","solutions":["Provide at least one of width or height in the resolver call (the other is derived from aspect ratio when available).","If using layout: 'fullWidth', ensure the schema still passes a width/height or that the sourceMetadata includes dimensions.","Use the standard GatsbyImage component which passes dimensions from the image data object.","Verify the source image node has width/height metadata populated by the source plugin."],"exampleFix":"// before\ngatsbyImageResolver(source, { layout: 'fixed' })\n// after\ngatsbyImageResolver(source, { layout: 'fixed', width: 300 })","handlingStrategy":"validation","validationCode":"// Ensure at least one dimension is provided\nif (!args.width && !args.height) {\n  throw new Error('Either width or height is required for image generation')\n}","typeGuard":"const hasDimension = (args: unknown): args is { width?: number; height?: number } =>\n  typeof args === 'object' && args !== null &&\n  (typeof (args as any).width === 'number' || typeof (args as any).height === 'number')","tryCatchPattern":null,"preventionTips":["Always provide at least one dimension (width or height) when requesting image transformations.","Use the GatsbyImage component to inherit dimensions from image data.","Validate source image metadata has width/height before transformation."],"tags":["gatsby","image","graphql","validation","dimensions"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}