{"record":{"id":"cad1833ab6aac827","repo":"Zackriya-Solutions/meetily","slug":"invalid-content-length-header-encoding","errorCode":null,"errorMessage":"Invalid Content-Length header encoding: {}","messagePattern":"Invalid Content-Length header encoding: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":719,"sourceCode":"            request = request.header(reqwest::header::RANGE, format!(\"bytes={range_start}-\"));\n        }\n\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,","sourceCodeStart":701,"sourceCodeEnd":737,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/a2cb62e827da7ef59f65064c97233efb2313878e/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L701-L737","documentation":"Thrown by `declared_content_length` in the Parakeet model downloader when the Content-Length response header exists but is not valid ASCII (reqwest's `HeaderValue::to_str()` fails). The header value is only allowed to contain visible ASCII characters; non-ASCII bytes make it unreadable as a number. This is a defensive check while probing the model server before downloading.","triggerScenarios":"A HEAD or GET request to the model URL returns a Content-Length header whose raw bytes are not valid visible ASCII (e.g. corrupted proxy-injected header, misbehaving CDN, or binary garbage in the header).","commonSituations":"Requests routed through a misconfigured reverse proxy or corporate proxy that rewrites headers; a compromised or non-standard HTTP server; header value mangled in transit.","solutions":["Bypass the proxy/CDN and request the model URL directly to see if the header is clean.","Verify the model server (or mirror URL configured for the Parakeet download) sends a proper numeric Content-Length.","Retry the download; transient corruption at an intermediary is often intermittent.","Use an alternate download mirror for the model."],"exampleFix":"// before: hard-fail on any header encoding problem\nvalue.to_str().map_err(|e| anyhow!(\"Invalid Content-Length header encoding: {}\", e))?;\n// after: tolerate undecodable headers by treating length as unknown\nlet len = value.to_str().ok().and_then(|s| s.parse::<u64>().ok());","handlingStrategy":"validation","validationCode":"let resp = client.head(url).send().await?;\nlet bad_cl = resp.headers().get(\"content-length\")\n    .map(|v| v.to_str().map_err(|_| \"non-ascii content-length\").and_then(|s| s.parse::<u64>().map_err(|_| \"non-numeric content-length\")).is_err())\n    .unwrap_or(false);\nif bad_cl { eprintln!(\"mirror sends invalid Content-Length; pick another mirror\"); }","typeGuard":"fn valid_content_length(v: &reqwest::header::HeaderValue) -> Option<u64> {\n    v.to_str().ok()?.parse::<u64>().ok()\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"Invalid Content-Length header encoding\") => fallback_to_mirror(),\n    other => other,\n}","preventionTips":["Prefer official model URLs over ad-hoc mirrors behind proxies.","Probe the URL with `curl -I` before wiring it into config.","Bypass corporate proxies for large model downloads."],"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"}