Zackriya-Solutions/meetily · error

Partial response range length overflow

Error message

Partial response range length overflow

What it means

Thrown by `validate_partial_response` when computing the expected range length via `end.checked_sub(start).and_then(|l| l.checked_add(1))` overflows `u64` — only possible with absurd/adversarial header values (e.g. end far below start or values near u64::MAX). It is an arithmetic-safety guard on untrusted server data.

Source

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

            .ok_or_else(|| anyhow!("Partial response is missing Content-Range"))?;
        let ContentRange::Range { start, end, total } = parse_content_range(content_range)? else {
            return Err(anyhow!("Partial response has an unsatisfied Content-Range"));
        };
        if start != expected_start || end != exact_bytes - 1 || total != exact_bytes {
            return Err(anyhow!(
                "Partial response range {}-{} / {} does not match {}-{} / {}",
                start,
                end,
                total,
                expected_start,
                exact_bytes - 1,
                exact_bytes
            ));
        }
        let expected_length = end
            .checked_sub(start)
            .and_then(|length| length.checked_add(1))
            .ok_or_else(|| anyhow!("Partial response range length overflow"))?;
        if let Some(content_length) = Self::declared_content_length(response)? {
            if content_length != expected_length {
                return Err(anyhow!(
                    "Partial response declared {} bytes, expected {}",
                    content_length,
                    expected_length
                ));
            }
        }
        Ok(())
    }

    fn validate_unsatisfied_response(response: &reqwest::Response, exact_bytes: u64) -> Result<()> {
        if response.status() != reqwest::StatusCode::RANGE_NOT_SATISFIABLE {
            return Err(anyhow!(
                "Expected range-not-satisfiable 416 response, received {}",
                response.status()
            ));

View on GitHub (pinned to a2cb62e827)

Solutions

  1. Switch to a trusted, official model URL — this indicates the server's headers are not trustworthy.
  2. Inspect the raw response headers (`curl -v -r 0-99 <url>`) to identify the bad server/proxy.
  3. Report the misbehaving mirror if it is one configured by the app.
Defensive patterns

Strategy: try-catch

Validate before calling

// Only download from allow-listed, trusted hosts
const TRUSTED_HOSTS: &[&str] = &["huggingface.co", "official-mirror.example"];
let host = reqwest::Url::parse(url)?.host_str().unwrap_or("").to_string();
if !TRUSTED_HOSTS.contains(&host.as_str()) { eprintln!("untrusted host; refusing download"); }

Try / catch

match result {
    Err(e) if e.to_string().contains("range length overflow") => {
        eprintln!("hostile/broken server headers; abort and switch source");
        switch_to_trusted_mirror()
    }
    other => other,
}

Prevention

When it happens

Trigger: A malicious or buggy server returns a Content-Range with start/end values whose span computation overflows u64 (e.g. start > end, or end == u64::MAX).

Common situations: Compromised or hostile mirror; fuzzed/corrupted responses from a broken proxy; essentially never seen with legitimate model servers.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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