Zackriya-Solutions/meetily · warning

Invalid Content-Range header encoding: {}

Error message

Invalid Content-Range header encoding: {}

What it means

parse_content_range converts a reqwest HeaderValue to &str via to_str(). HeaderValue::to_str errors when the header contains non-visible-ASCII bytes, and that error is wrapped as 'Invalid Content-Range header encoding'. It is thrown while validating a 206 Partial Content (or 416) response from a Parakeet model server.

Source

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

    continue_discovery: tokio::sync::Notify,
}

#[cfg(test)]
struct ModelLifecycleTestHook {
    load_started: tokio::sync::Notify,
    continue_load: tokio::sync::Notify,
    unload_attempted: tokio::sync::Notify,
}

enum ContentRange {
    Range { start: u64, end: u64, total: u64 },
    Unsatisfied { total: u64 },
}

fn parse_content_range(value: &reqwest::header::HeaderValue) -> Result<ContentRange> {
    let value = value
        .to_str()
        .map_err(|e| anyhow!("Invalid Content-Range header encoding: {}", e))?;
    let value = value
        .strip_prefix("bytes ")
        .ok_or_else(|| anyhow!("Content-Range must use bytes: {}", value))?;

    if let Some(total) = value.strip_prefix("*/") {
        return total
            .parse()
            .map(|total| ContentRange::Unsatisfied { total })
            .map_err(|e| anyhow!("Invalid unsatisfied Content-Range total: {}", e));
    }

    let (range, total) = value
        .split_once('/')
        .ok_or_else(|| anyhow!("Malformed Content-Range: {}", value))?;
    let (start, end) = range
        .split_once('-')
        .ok_or_else(|| anyhow!("Malformed Content-Range range: {}", value))?;
    let start = start

View on GitHub (pinned to a2cb62e827)

Solutions

  1. Inspect the raw response headers (curl -i) to find what is corrupting Content-Range.
  2. Fix or bypass the proxy/intermediate server mangling headers.
  3. If you control the server, ensure it emits ASCII Content-Range like 'bytes 0-1023/4096'.
  4. As a fallback, fall back to a non-range (full) download path when the header is unparseable.
Defensive patterns

Strategy: try-catch

Try / catch

match resp.headers().get(CONTENT_RANGE) {
    Some(h) => match parse_content_range(h) {
        Ok(cr) => use_range(cr),
        Err(_) => fallback_to_full_download(), // header unusable
    },
    None => fallback_to_full_download(),
}

Prevention

When it happens

Trigger: validate_partial_response/validate_unsatisfied_response reading a Content-Range header whose bytes are not valid visible ASCII (per HTTP spec, essentially impossible from a compliant server, so usually a corrupted/proxied/mangled response).

Common situations: Misbehaving proxy or middleware injecting header values with UTF-8/non-ASCII characters; a mock/dev server writing headers incorrectly; binary corruption between server and client.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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