{"record":{"id":"72f5383805786f1f","repo":"gatsbyjs/gatsby","slug":"no-width-or-height-is-given-to-resize-source-ur","errorCode":null,"errorMessage":"No width or height is given to resize \"${source.url}\"","messagePattern":"No width or height is given to resize \"(.+?)\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-utils/src/polyfill-remote-file/graphql/resize-resolver.ts","lineNumber":69,"sourceCode":"    return null\n  }\n\n  if (!args.format) {\n    args.format = `auto`\n  }\n\n  if (!args.quality) {\n    args.quality = DEFAULT_QUALITY\n  }\n\n  if (!allowedFormats.includes(args.format)) {\n    throw new Error(\n      `Unknown format \"${args.format}\" was given to resize ${source.url}`\n    )\n  }\n\n  if (!args.width && !args.height) {\n    throw new Error(`No width or height is given to resize \"${source.url}\"`)\n  }\n\n  const formats = validateAndNormalizeFormats(\n    [args.format],\n    getImageFormatFromMimeType(source.mimeType)\n  )\n  const [format] = formats\n  const { width, height } = calculateImageDimensions(\n    source,\n    args as IResizeArgs & WidthOrHeight\n  )\n\n  if (shouldDispatchLocalImageServiceJob()) {\n    dispatchLocalImageServiceJob(\n      {\n        url: source.url,\n        mimeType: source.mimeType,\n        filename: source.filename,","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-utils/src/polyfill-remote-file/graphql/resize-resolver.ts#L51-L87","documentation":"Thrown by the resize resolver when neither args.width nor args.height is provided for a resize operation. At least one dimension is mandatory for the image service to compute the output size.","triggerScenarios":"Both args.width and args.height are falsy after format/quality defaults are applied; the resize cannot proceed without a target dimension.","commonSituations":"A GraphQL query calls the resize field with only format/quality but omits dimensions, or a programmatic call forgets to pass width/height.","solutions":["Provide at least width or height in the resize arguments.","If using a fixed layout, pass width; for responsive, ensure the schema provides dimensions.","Check that the GraphQL field definition for resize enforces at least one dimension argument."],"exampleFix":"// before\nresizeImage(source, { format: 'webp' })\n// after\nresizeImage(source, { format: 'webp', width: 400 })","handlingStrategy":"validation","validationCode":"// Ensure at least one dimension for resize\nif (!args.width && !args.height) {\n  throw new Error('At least width or height is required for resize')\n}","typeGuard":"const hasResizeDimension = (args: unknown): args is { width?: number; height?: number } =>\n  typeof args === 'object' && args !== null &&\n  ((args as any).width > 0 || (args as any).height > 0)","tryCatchPattern":null,"preventionTips":["Always include width or height when calling the resize resolver.","Validate GraphQL schema requires at least one dimension argument.","Use GatsbyImage components that handle dimensions automatically."],"tags":["gatsby","image","validation","dimensions","resolver"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}