vercel/next.js · error · ImageError
"url" parameter is valid but upstream response timed out
Error message
"url" parameter is valid but upstream response timed out
What it means
Timeout failure in fetchExternalImage: the upstream image fetch is wrapped with AbortSignal.timeout(7_000), and when the timer fires the fetch rejects with a TimeoutError. The catch block distinguishes it from other fetch errors and throws ImageError 504 so the client knows the URL was acceptable but the origin was too slow.
Solutions
- Check that the upstream image server responds quickly; increase timeout or fix the upstream host.
Defensive patterns
Strategy: retry
When it happens
Trigger: The upstream image fetch times out.
Common situations: A slow or unreachable remote image server when optimizing remote images.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
AI-assisted analysis of vercel/next.js@996f957c06 (2026-08-19).
Data as JSON: /api/errors/0ec56a42e8229f2b.
Report an issue: GitHub.
Appendix: source
Thrown at packages/next/src/server/image-optimizer.ts:559
'upstream image',
href,
'hostname resolved to private IP',
JSON.stringify(privateIps),
'If this is expected and you understand SSRF risk, use images.dangerouslyAllowLocalIP = true to continue.'
)
throw new ImageError(400, '"url" parameter is not allowed')
}
}
const res = await fetch(href, {
signal: AbortSignal.timeout(7_000),
redirect: 'manual',
}).catch((err) => err as Error)
if (res instanceof Error) {
const err = res as Error
if (err.name === 'TimeoutError') {
Log.error('upstream image response timed out for', href)
throw new ImageError(
504,
'"url" parameter is valid but upstream response timed out'
)
}
throw err
}
const locationHeader = res.headers.get('Location')
if (
isRedirect(res.status) &&
locationHeader &&
URL.canParse(locationHeader, href)
) {
if (count === 0) {
Log.error('upstream image response had too many redirects', href)
throw new ImageError(
508,
'"url" parameter is valid but upstream response is invalid'View on GitHub (pinned to 996f957c06)