{"record":{"id":"0ec56a42e8229f2b","repo":"vercel/next.js","slug":"url-parameter-is-valid-but-upstream-response-tim","errorCode":null,"errorMessage":"\"url\" parameter is valid but upstream response timed out","messagePattern":"\"url\" parameter is valid but upstream response timed out","errorType":"http","errorClass":"ImageError","httpStatus":504,"severity":"error","filePath":"packages/next/src/server/image-optimizer.ts","lineNumber":559,"sourceCode":"        'upstream image',\n        href,\n        'hostname resolved to private IP',\n        JSON.stringify(privateIps),\n        'If this is expected and you understand SSRF risk, use images.dangerouslyAllowLocalIP = true to continue.'\n      )\n      throw new ImageError(400, '\"url\" parameter is not allowed')\n    }\n  }\n  const res = await fetch(href, {\n    signal: AbortSignal.timeout(7_000),\n    redirect: 'manual',\n  }).catch((err) => err as Error)\n\n  if (res instanceof Error) {\n    const err = res as Error\n    if (err.name === 'TimeoutError') {\n      Log.error('upstream image response timed out for', href)\n      throw new ImageError(\n        504,\n        '\"url\" parameter is valid but upstream response timed out'\n      )\n    }\n    throw err\n  }\n\n  const locationHeader = res.headers.get('Location')\n  if (\n    isRedirect(res.status) &&\n    locationHeader &&\n    URL.canParse(locationHeader, href)\n  ) {\n    if (count === 0) {\n      Log.error('upstream image response had too many redirects', href)\n      throw new ImageError(\n        508,\n        '\"url\" parameter is valid but upstream response is invalid'","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/vercel/next.js/blob/996f957c060aa17957a166216c69565c72996f4a/packages/next/src/server/image-optimizer.ts#L541-L577","documentation":"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.","triggerScenarios":"The upstream image fetch times out.","commonSituations":"A slow or unreachable remote image server when optimizing remote images.","solutions":["Check that the upstream image server responds quickly; increase timeout or fix the upstream host."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"996f957c060aa17957a166216c69565c72996f4a","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}