{"record":{"id":"6c31076497662ec5","repo":"remotion-dev/remotion","slug":"content-length-header-not-found","errorCode":null,"errorMessage":"Content-Length header not found","messagePattern":"Content-Length header not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/install-whisper-cpp/src/download.ts","lineNumber":27,"sourceCode":"\tsignal,\n}: {\n\tfileStream: NodeJS.WritableStream;\n\turl: string;\n\tprintOutput: boolean;\n\tonProgress: OnProgress | undefined;\n\tsignal: AbortSignal | null;\n}) => {\n\tconst {body, headers} = await fetch(url, {\n\t\tsignal,\n\t});\n\tconst contentLength = headers.get('content-length');\n\n\tif (body === null) {\n\t\tthrow new Error('Failed to download whisper model');\n\t}\n\n\tif (contentLength === null) {\n\t\tthrow new Error('Content-Length header not found');\n\t}\n\n\tlet downloaded = 0;\n\tlet lastPrinted = 0;\n\n\tconst totalFileSize = parseInt(contentLength, 10);\n\n\tconst reader = body.getReader();\n\t// eslint-disable-next-line no-async-promise-executor\n\tawait new Promise<void>(async (resolve, reject) => {\n\t\ttry {\n\t\t\twhile (true) {\n\t\t\t\tconst {done, value} = await reader.read();\n\n\t\t\t\tif (value) {\n\t\t\t\t\tdownloaded += value.length;\n\n\t\t\t\t\tif (","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/install-whisper-cpp/src/download.ts#L9-L45","documentation":"Thrown by the internal `downloadFile` helper when the response from `fetch(url)` has no `content-length` header. The helper requires a known total size to drive its progress reporting and validation, so a missing header is a hard error rather than a silent best-effort download.","triggerScenarios":"The server responds with `Transfer-Encoding: chunked` and no `Content-Length`, or a proxy strips the header. The official HuggingFace and GitHub Release URLs normally include it, so a missing header points at an intermediary.","commonSituations":"Corporate proxies or firewalls that re-chunk responses; a mirror/CDN that omits content-length; pointing at a custom URL that streams without a known length; HTTP/2 push configurations.","solutions":["Use the default official URLs (HuggingFace for models, GitHub Releases for whisper.cpp) which include content-length.","If a proxy is stripping the header, bypass it or reconfigure it to preserve `content-length`.","Host the binary on a server/CDN that sends `Content-Length` (e.g. S3 with a known object size).","Retry in case of a transient proxy issue."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async function urlReportsLength(url: string): Promise<boolean> {\n  const res = await fetch(url, {method: 'HEAD'});\n  return res.headers.get('content-length') !== null;\n}\n\nif (!await urlReportsLength(modelUrl)) {\n  throw new Error('Mirror must send Content-Length; pick the official URL.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the default official URLs (HuggingFace for models, GitHub Releases for whisper.cpp) which include content-length.","If mirroring, choose object storage (e.g. S3) that emits a known content-length.","Check that proxies in the path preserve content-length rather than re-chunking."],"tags":["whisper","network","download","headers"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}