vercel/next.js · error · Error
Image with src "${src}" has invalid "height" property. Expec
Error message
Image with src "${src}" has invalid "height" property. Expected a numeric value in pixels but received "${height}". What it means
Thrown by getImgProps during prop validation when the image is not using "fill" and the "height" prop cannot be interpreted as a number. At this point width has already been checked; the guard calls isNaN on the parsed height value, so the error fires when height is a non-numeric string (e.g. "auto"), NaN, or otherwise unparseable, rather than a pixel number like 640.
Source
Thrown at packages/next/src/shared/lib/get-img-props.ts:522
`Image with src "${src}" has both "fill" and "style.height" properties. Images with "fill" always use height 100% - it cannot be modified.`
)
}
} else {
if (typeof widthInt === 'undefined') {
throw new Error(
`Image with src "${src}" is missing required "width" property.`
)
} else if (isNaN(widthInt)) {
throw new Error(
`Image with src "${src}" has invalid "width" property. Expected a numeric value in pixels but received "${width}".`
)
}
if (typeof heightInt === 'undefined') {
throw new Error(
`Image with src "${src}" is missing required "height" property.`
)
} else if (isNaN(heightInt)) {
throw new Error(
`Image with src "${src}" has invalid "height" property. Expected a numeric value in pixels but received "${height}".`
)
}
// eslint-disable-next-line no-control-regex
if (/^[\x00-\x20]/.test(src)) {
throw new Error(
`Image with src "${src}" cannot start with a space or control character. Use src.trimStart() to remove it or encodeURIComponent(src) to keep it.`
)
}
// eslint-disable-next-line no-control-regex
if (/[\x00-\x20]$/.test(src)) {
throw new Error(
`Image with src "${src}" cannot end with a space or control character. Use src.trimEnd() to remove it or encodeURIComponent(src) to keep it.`
)
}
}
}
if (!VALID_LOADING_VALUES.includes(loading)) {View on GitHub (pinned to 0eb3775416)
Solutions
- Pass height as a number of pixels (not a string like "auto").
Defensive patterns
Strategy: validation
When it happens
Trigger: next/image height prop is not a numeric pixel value.
Common situations: Passing a string like '100px' as height to next/image.
AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19).
Data as JSON: /api/errors/55cf85d230696053.
Report an issue: GitHub.