remotion-dev/remotion · error · Error

HTTP response of ${srcWithoutHash} has no body

Error message

HTTP response of ${srcWithoutHash} has no body

What it means

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.

Source

Thrown at packages/core/src/prefetch.ts:183

			const headerContentType = res.headers.get('Content-Type');

			const contentType = options?.contentType ?? headerContentType;
			const hasProperContentType =
				contentType &&
				(contentType.startsWith('video/') ||
					contentType.startsWith('audio/') ||
					contentType.startsWith('image/'));

			if (!hasProperContentType) {
				// eslint-disable-next-line no-console
				console.warn(
					`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.`,
				);
			}

			if (!res.body) {
				throw new Error(`HTTP response of ${srcWithoutHash} has no body`);
			}

			const responseReader = res.body.getReader();
			reader = responseReader;

			return getBlobFromReader({
				reader: responseReader,
				contentType: options?.contentType ?? headerContentType ?? null,
				contentLength: res.headers.get('Content-Length')
					? parseInt(res.headers.get('Content-Length')!, 10)
					: null,
				onProgress: options?.onProgress,
			});
		})
		.then((buf) => {
			if (!buf || canceled) {
				return;
			}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Verify the URL returns actual bytes: curl -i <url> | head.
  2. Check the origin server/proxy is not sending an empty body.
  3. Retry — an empty body can be a transient connection drop.
Defensive patterns

Strategy: retry

Validate before calling

async function hasBody(url: string) {
  const res = await fetch(url);
  return Boolean(res.ok && res.body);
}

Try / catch

try {
  await prefetch(src);
} catch (err) {
  if (/has no body/.test(String(err))) {
    // retry once, or fall back to a mirror URL
  } else throw err;
}

Prevention

When it happens

Trigger: Server responds 200 with no body; an intermediary (proxy/CDN) strips the body; a HEAD-style response; the body stream was already consumed upstream.

Common situations: Misconfigured CDN returning headers then closing the connection; transparent proxy issue; transient connection drop mid-response.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/785349fcec7df9db. Report an issue: GitHub.