Zackriya-Solutions/meetily · error

Invalid Content-Length header: {}

Error message

Invalid Content-Length header: {}

What it means

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.

Source

Thrown at frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs:721

        tokio::select! {
            biased;
            _ = active_download.cancellation.cancelled() => Err(DownloadCancelled.into()),
            response = request.send() => response
                .map_err(|error| anyhow!("Failed to start download for {}: {}", file_url, error)),
        }
    }

    fn declared_content_length(response: &reqwest::Response) -> Result<Option<u64>> {
        response
            .headers()
            .get(reqwest::header::CONTENT_LENGTH)
            .map(|value| {
                value
                    .to_str()
                    .map_err(|error| anyhow!("Invalid Content-Length header encoding: {}", error))?
                    .parse()
                    .map_err(|error| anyhow!("Invalid Content-Length header: {}", error))
            })
            .transpose()
    }

    fn validate_full_response(response: &reqwest::Response, exact_bytes: u64) -> Result<()> {
        if response.status() != reqwest::StatusCode::OK {
            return Err(anyhow!(
                "Expected full 200 response, received {}",
                response.status()
            ));
        }
        if let Some(content_length) = Self::declared_content_length(response)? {
            if content_length != exact_bytes {
                return Err(anyhow!(
                    "Full response declared {} bytes, expected {}",
                    content_length,
                    exact_bytes
                ));

View on GitHub (pinned to a2cb62e827)

Solutions

  1. Check the server's Content-Length header with `curl -I <model-url>` and fix the server config if it is non-numeric.
  2. Point the download at the official model URL / mirror instead of the custom one.
  3. Disable intermediaries (proxy, antivirus HTTPS scanning) that may rewrite headers.
  4. Retry via a different network to rule out middlebox corruption.

Example fix

// server (nginx) sending invalid header
add_header Content-Length "unknown";
// after
# let nginx compute it automatically; do not set Content-Length manually
Defensive patterns

Strategy: validation

Validate before calling

let resp = client.head(url).send().await?;
if let Some(v) = resp.headers().get("content-length") {
    let ok = v.to_str().map_err(|_| ())?.parse::<u64>().is_ok();
    if !ok { eprintln!("Content-Length is not numeric: {:?}", v); }
}

Type guard

fn parse_content_length(resp: &reqwest::Response) -> Option<u64> {
    resp.headers().get(reqwest::header::CONTENT_LENGTH)?.to_str().ok()?.parse().ok()
}

Try / catch

match result {
    Err(e) if e.to_string().contains("Invalid Content-Length header:") => retry_with_alternate_mirror(),
    other => other,
}

Prevention

When it happens

Trigger: A response from the Parakeet model URL includes `Content-Length` with a non-numeric value such as `"12,345"`, `"unknown"`, or an empty string.

Common situations: 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.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@a2cb62e827 (2026-09-12). Data as JSON: /api/errors/c6edb43e466cddd7. Report an issue: GitHub.