gatsbyjs/gatsby · error

${format} is not a valid format. Valid formats are: jpg, jpe

Error message

${format} is not a valid format. Valid formats are: jpg, jpeg, png, webp, auto

What it means

In urlBuilder for Shopify images, the requested format is validated against jpg, jpeg, png, webp, and auto. When a caller passes an unsupported format, the warning fires and the format is coerced to auto, so the generated CDN URL uses Shopify's automatic format selection instead of the requested one.

Source

Thrown at packages/gatsby-source-shopify/src/get-shopify-image.ts:16

import {
  IUrlBuilderArgs,
  getImageData,
  IGatsbyImageData,
} from "gatsby-plugin-image"

const validFormats = new Set([`jpg`, `jpeg`, `png`, `webp`, `auto`])

export function urlBuilder({
  width,
  height,
  baseUrl,
  format,
}: IUrlBuilderArgs<unknown>): string {
  if (!validFormats.has(format)) {
    console.warn(
      `${format} is not a valid format. Valid formats are: ${[
        ...validFormats,
      ].join(`, `)}`
    )
    format = `auto`
  }

  let [basename, version] = baseUrl.split(`?`)

  const dot = basename.lastIndexOf(`.`)
  let ext = ``
  if (dot !== -1) {
    ext = basename.slice(dot + 1)
    basename = basename.slice(0, dot)
  }
  let suffix = ``
  if (format === ext || format === `auto`) {
    suffix = `.${ext}`

View on GitHub (pinned to e85d62f177)

Solutions

  1. Pass one of the valid formats (jpg, jpeg, png, webp, auto) in image transform options.
  2. Remove the explicit format option to let it default to auto.
  3. If another format is genuinely needed, check whether Shopify's CDN supports it before requesting.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/gatsby-source-shopify/src/get-shopify-image.ts:16 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/40875b291c465680. Report an issue: GitHub.