{"record":{"id":"e0442eb0b20201b6","repo":"gatsbyjs/gatsby","slug":"unknown-format-args-format-was-given-to-resiz","errorCode":null,"errorMessage":"Unknown format \"${args.format}\" was given to resize ${source.url}","messagePattern":"Unknown format \"(.+?)\" was 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":63,"sourceCode":"): Promise<{\n  width: number\n  height: number\n  src: string\n} | null> {\n  if (!isImage(source)) {\n    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","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-utils/src/polyfill-remote-file/graphql/resize-resolver.ts#L45-L81","documentation":"Thrown by the resize resolver when args.format is not in the allowedFormats list (jpg, png, webp, avif, auto). After defaulting format to 'auto', the resolver validates that the requested format is one of the supported image output formats.","triggerScenarios":"args.format is set to a value outside allowedFormats (e.g., 'gif', 'tiff', 'jpeg', or a typo like 'webP'), triggering the includes() check to fail.","commonSituations":"A query passes format: 'jpeg' instead of 'jpg', uses uppercase 'WEBP', or requests an unsupported format like 'gif' or 'svg'.","solutions":["Use one of the supported formats: 'jpg', 'png', 'webp', 'avif', or 'auto'.","Use 'jpg' (not 'jpeg') for JPEG output.","Use lowercase format strings — the check is case-sensitive.","Omit the format argument entirely to default to 'auto'."],"exampleFix":"// before\nresizeImage(source, { format: 'jpeg', width: 200 })\n// after\nresizeImage(source, { format: 'jpg', width: 200 })","handlingStrategy":"validation","validationCode":"const allowedFormats = ['jpg', 'png', 'webp', 'avif', 'auto']\nif (args.format && !allowedFormats.includes(args.format)) {\n  throw new Error(`Unsupported format: ${args.format}. Allowed: ${allowedFormats.join(', ')}`)\n}","typeGuard":"const ALLOWED = new Set(['jpg', 'png', 'webp', 'avif', 'auto'])\nconst isImageFormat = (val: unknown): val is ImageFormat =>\n  typeof val === 'string' && ALLOWED.has(val)","tryCatchPattern":null,"preventionTips":["Use only lowercase supported format names: jpg, png, webp, avif, auto.","Remember 'jpg' not 'jpeg' for JPEG output.","Omit format to default to 'auto' when unsure."],"tags":["gatsby","image","validation","format","resolver"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}