{"record":{"id":"cd8db062dd16c056","repo":"remotion-dev/remotion","slug":"no-body","errorCode":null,"errorMessage":"No body","messagePattern":"No body","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/readers/fetch/get-body-and-reader.ts","lineNumber":66,"sourceCode":"\t\t\t\tstreamCancelled = true;\n\t\t\t},\n\t\t});\n\n\t\treturn {\n\t\t\tcontentLength: encoded.byteLength,\n\t\t\treader: {\n\t\t\t\treader: stream.getReader(),\n\t\t\t\tabort: () => {\n\t\t\t\t\townController.abort();\n\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t},\n\t\t\t},\n\t\t\tneedsContentRange: false,\n\t\t};\n\t}\n\n\tif (!res.body) {\n\t\tthrow new Error('No body');\n\t}\n\n\tconst reader = res.body.getReader();\n\n\treturn {\n\t\treader: {\n\t\t\treader,\n\t\t\tabort: () => {\n\t\t\t\townController.abort();\n\t\t\t\treturn Promise.resolve();\n\t\t\t},\n\t\t},\n\t\tcontentLength,\n\t\tneedsContentRange: true,\n\t};\n};\n","sourceCodeStart":48,"sourceCodeEnd":83,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/readers/fetch/get-body-and-reader.ts#L48-L83","documentation":"getLengthAndReader throws 'No body' when, after ruling out the canLiveWithoutContentLength / requestedWithoutRange fast paths, res.body is null/undefined. The reader needs a ReadableStream body to pump bytes; without one it cannot deliver samples. This path is reached for ranged requests where Content-Length is present but the server returned an empty body.","triggerScenarios":"A ranged fetch whose response has no body (res.body null) — e.g. a HEAD-like response, a server returning 200 with Content-Length but empty body, or an intermediary that swallowed the body. Reached only when not on the buffered/arrayBuffer path.","commonSituations":"Misconfigured serverless functions returning headers without a body, intermediaries that strip the body under certain conditions, 204/3xx mishandled as success, or a server that closed the stream immediately.","solutions":["Ensure the server actually streams the media body for ranged GET requests (return a real ReadableStream / pipe the file).","Verify the response status is 200 or 206 with a non-empty body using curl: `curl -v -r 0-100 <url>`.","Check that no middleware (auth redirects, compression) is converting the response into a bodyless one.","If you cannot fix the server, host the asset on a CDN/object store that serves bytes correctly."],"exampleFix":"// before: serverless returns headers, no body\nexport default (req, res) => res.status(200).end();\n\n// after: stream the actual bytes with Content-Length\nimport fs from 'node:fs';\nexport default (req, res) => {\n  const stat = fs.statSync(file);\n  res.set('Content-Length', String(stat.size)).set('Accept-Ranges','bytes');\n  fs.createReadStream(file).pipe(res);\n};","handlingStrategy":"validation","validationCode":"// Confirm ranged GET returns a body\nconst r = await fetch(url, {headers: {Range: 'bytes=0-99'}});\nif (!r.body) throw new Error('Server returned no body for ranged GET');","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({src: url, fields: {durationInSeconds: true}});\n} catch (e) {\n  if (e instanceof Error && e.message === 'No body') {\n    throw new Error('Media endpoint returned an empty body');\n  }\n  throw e;\n}","preventionTips":["Ensure endpoints pipe real bytes for media GET requests.","Test ranged responses with curl -v -r 0-100 <url>.","Avoid serverless patterns that return headers without a body.","Host media on a CDN/object store that streams bodies correctly."],"tags":["network","http","empty-body","media-parser"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}