{"record":{"id":"c6edb43e466cddd7","repo":"Zackriya-Solutions/meetily","slug":"invalid-content-length-header","errorCode":null,"errorMessage":"Invalid Content-Length header: {}","messagePattern":"Invalid Content-Length header: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":721,"sourceCode":"\n        tokio::select! {\n            biased;\n            _ = active_download.cancellation.cancelled() => Err(DownloadCancelled.into()),\n            response = request.send() => response\n                .map_err(|error| anyhow!(\"Failed to start download for {}: {}\", file_url, error)),\n        }\n    }\n\n    fn declared_content_length(response: &reqwest::Response) -> Result<Option<u64>> {\n        response\n            .headers()\n            .get(reqwest::header::CONTENT_LENGTH)\n            .map(|value| {\n                value\n                    .to_str()\n                    .map_err(|error| anyhow!(\"Invalid Content-Length header encoding: {}\", error))?\n                    .parse()\n                    .map_err(|error| anyhow!(\"Invalid Content-Length header: {}\", error))\n            })\n            .transpose()\n    }\n\n    fn validate_full_response(response: &reqwest::Response, exact_bytes: u64) -> Result<()> {\n        if response.status() != reqwest::StatusCode::OK {\n            return Err(anyhow!(\n                \"Expected full 200 response, received {}\",\n                response.status()\n            ));\n        }\n        if let Some(content_length) = Self::declared_content_length(response)? {\n            if content_length != exact_bytes {\n                return Err(anyhow!(\n                    \"Full response declared {} bytes, expected {}\",\n                    content_length,\n                    exact_bytes\n                ));","sourceCodeStart":703,"sourceCodeEnd":739,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/a2cb62e827da7ef59f65064c97233efb2313878e/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L703-L739","documentation":"Thrown by `declared_content_length` when the Content-Length header decodes as ASCII but does not parse into a `u64` (e.g. it is empty, contains letters, or has stray whitespace/commas). The downloader needs an exact byte count to validate the model download, so a non-numeric value is rejected.","triggerScenarios":"A response from the Parakeet model URL includes `Content-Length` with a non-numeric value such as `\"12,345\"`, `\"unknown\"`, or an empty string.","commonSituations":"Custom model-mirror servers (e.g. a local nginx or Python http.server misconfiguration) emitting malformed headers; CDN edge returning an error page with odd headers; HTTP/1.0 style responses with duplicated headers.","solutions":["Check the server's Content-Length header with `curl -I <model-url>` and fix the server config if it is non-numeric.","Point the download at the official model URL / mirror instead of the custom one.","Disable intermediaries (proxy, antivirus HTTPS scanning) that may rewrite headers.","Retry via a different network to rule out middlebox corruption."],"exampleFix":"// server (nginx) sending invalid header\nadd_header Content-Length \"unknown\";\n// after\n# let nginx compute it automatically; do not set Content-Length manually","handlingStrategy":"validation","validationCode":"let resp = client.head(url).send().await?;\nif let Some(v) = resp.headers().get(\"content-length\") {\n    let ok = v.to_str().map_err(|_| ())?.parse::<u64>().is_ok();\n    if !ok { eprintln!(\"Content-Length is not numeric: {:?}\", v); }\n}","typeGuard":"fn parse_content_length(resp: &reqwest::Response) -> Option<u64> {\n    resp.headers().get(reqwest::header::CONTENT_LENGTH)?.to_str().ok()?.parse().ok()\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"Invalid Content-Length header:\") => retry_with_alternate_mirror(),\n    other => other,\n}","preventionTips":["Never set Content-Length manually on static file servers; let the server compute it.","Test mirrors with `curl -I` before use.","Keep proxies/CDN transforms out of large-binary download paths."],"tags":["network","http-headers","download"],"backgroundTag":"unexpected-response-shape","analyzedSha":"a2cb62e827da7ef59f65064c97233efb2313878e","analyzedAt":"2026-09-12T11:12:14.152Z","contentChangedAt":"2026-09-12T11:12:14.152Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}