gatsbyjs/gatsby · error
Either the "width" or "height" argument is required f
Error message
Either the "width" or "height" argument is required for "${source.url}"
What it means
gatsbyImageResolver validates resolver args upfront: after requiring layout, it requires that at least one of width or height be present so image dimensions can be derived. Both absent means the GraphQL field was queried without sizing arguments (and no defaults apply).
Source
Thrown at packages/gatsby-plugin-utils/src/polyfill-remote-file/graphql/gatsby-image-resolver.ts:102
store?: Store
): Promise<{
images: IGatsbyImageData
layout: string
width: number
height: number
backgroundColor?: string
placeholder?: { fallback: string } | undefined
} | null> {
if (!isImage(source)) {
return null
}
if (!args.layout) {
throw new Error(`The "layout" argument is required for "${source.url}"`)
}
if (!args.width && !args.height) {
throw new Error(`
Either the "width" or "height" argument is required for "${source.url}"
`)
}
if (!args.formats) {
args.formats = [`auto`, `webp`, `avif`]
}
if (!args.outputPixelDensities) {
args.outputPixelDensities = DEFAULT_PIXEL_DENSITIES
}
if (!args.breakpoints) {
args.breakpoints = DEFAULT_BREAKPOINTS
}
if (!args.fit) {
args.fit = `cover`View on GitHub (pinned to e85d62f177)
Solutions
- Pass width or height to the gatsbyImage field in the query
- Set a layout plus one dimension in the GraphQL argument
- Rely on the parent resolver defaults instead of calling with empty args
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/gatsby-plugin-utils/src/polyfill-remote-file/graphql/gatsby-image-resolver.ts:102 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/540c7940b82929b4.
Report an issue: GitHub.