{"record":{"id":"785349fcec7df9db","repo":"remotion-dev/remotion","slug":"http-response-of-srcwithouthash-has-no-body","errorCode":null,"errorMessage":"HTTP response of ${srcWithoutHash} has no body","messagePattern":"HTTP response of (.+?) has no body","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/prefetch.ts","lineNumber":183,"sourceCode":"\n\t\t\tconst headerContentType = res.headers.get('Content-Type');\n\n\t\t\tconst contentType = options?.contentType ?? headerContentType;\n\t\t\tconst hasProperContentType =\n\t\t\t\tcontentType &&\n\t\t\t\t(contentType.startsWith('video/') ||\n\t\t\t\t\tcontentType.startsWith('audio/') ||\n\t\t\t\t\tcontentType.startsWith('image/'));\n\n\t\t\tif (!hasProperContentType) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Called prefetch() on ${srcWithoutHash} which returned a \"Content-Type\" of ${headerContentType}. Prefetched content should have a proper content type (video/... or audio/...) or a contentType passed the options of prefetch(). Otherwise, prefetching will not work properly in all browsers.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!res.body) {\n\t\t\t\tthrow new Error(`HTTP response of ${srcWithoutHash} has no body`);\n\t\t\t}\n\n\t\t\tconst responseReader = res.body.getReader();\n\t\t\treader = responseReader;\n\n\t\t\treturn getBlobFromReader({\n\t\t\t\treader: responseReader,\n\t\t\t\tcontentType: options?.contentType ?? headerContentType ?? null,\n\t\t\t\tcontentLength: res.headers.get('Content-Length')\n\t\t\t\t\t? parseInt(res.headers.get('Content-Length')!, 10)\n\t\t\t\t\t: null,\n\t\t\t\tonProgress: options?.onProgress,\n\t\t\t});\n\t\t})\n\t\t.then((buf) => {\n\t\t\tif (!buf || canceled) {\n\t\t\t\treturn;\n\t\t\t}","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/prefetch.ts#L165-L201","documentation":"After a successful 2xx fetch with a proper Content-Type, prefetch() requires a readable response body (`res.body`). If the server returns 200 with headers but an empty/absent body, it throws because there is nothing to stream into the cached blob.","triggerScenarios":"Server responds 200 with no body; an intermediary (proxy/CDN) strips the body; a HEAD-style response; the body stream was already consumed upstream.","commonSituations":"Misconfigured CDN returning headers then closing the connection; transparent proxy issue; transient connection drop mid-response.","solutions":["Verify the URL returns actual bytes: curl -i <url> | head.","Check the origin server/proxy is not sending an empty body.","Retry — an empty body can be a transient connection drop."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async function hasBody(url: string) {\n  const res = await fetch(url);\n  return Boolean(res.ok && res.body);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await prefetch(src);\n} catch (err) {\n  if (/has no body/.test(String(err))) {\n    // retry once, or fall back to a mirror URL\n  } else throw err;\n}","preventionTips":["curl -i the URL to confirm it streams real bytes.","Check proxies/CDNs are not stripping the body.","Retry once on empty-body responses (often transient)."],"tags":["network","prefetch","http","media"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}