Zackriya-Solutions/meetily · error
Malformed Content-Range range: {}
Error message
Malformed Content-Range range: {} What it means
Thrown by parse_content_range when the portion before '/' in a Content-Range header cannot be split into 'start-end' with a '-' separator. The header had a total part but the byte-range portion itself is malformed, so the range bounds cannot be determined.
Source
Thrown at frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs:215
.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
.parse()
.map_err(|e| anyhow!("Invalid Content-Range start: {}", e))?;
let end = end
.parse()
.map_err(|e| anyhow!("Invalid Content-Range end: {}", e))?;
let total = total
.parse()
.map_err(|e| anyhow!("Invalid Content-Range total: {}", e))?;
if start > end {
return Err(anyhow!("Content-Range start exceeds end: {}", value));
}
Ok(ContentRange::Range { start, end, total })
}
#[derive(Debug)]
pub enum ParakeetEngineError {View on GitHub (pinned to a2cb62e827)
Solutions
- Correct the mirror/server so it emits 'bytes start-end/total' format
- Inspect the raw header value logged in the error message
- Test the endpoint with curl -r to confirm correct '-' separator
- If you control the client, trim whitespace or 'bytes=' prefix before parsing
Example fix
// malformed value fed to parser // before: Content-Range: bytes 01023/2048 // after: Content-Range: bytes 0-1023/2048
Defensive patterns
Strategy: validation
Validate before calling
fn valid_range_part(v: &str) -> bool { let main = v.trim().trim_start_matches("bytes "); main.split_once('/').map_or(false, |(r, _)| r.split_once('-').is_some()) } Try / catch
match parse_content_range(header_value) { Err(e) => { log::warn!("bad Content-Range: {e}"); restart_download_from_scratch() }, Ok(cr) => resume(cr) } Prevention
- Normalize headers (trim, strip 'bytes=' prefix) before parsing
- Unit-test the parser with real server header samples
- Reject mirrors that emit non-standard range syntax early in setup
When it happens
Trigger: A 206 partial-content response from the model server has a Content-Range like 'bytes 01023/2048' or 'bytes /2048' — no '-' between start and end — while validate_partial_response or validate_unsatisfied_response is checking a resumed download.
Common situations: Custom/non-standard model mirrors emitting hand-written range headers; header values mangled by middleware; tests feeding fake header strings with wrong separators (e.g. '0..1023/2048').
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.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Malformed Content-Range: {}
- Invalid Content-Range total: {}
- Invalid Content-Range start: {}
- Invalid Content-Range end: {}
- Content-Range start exceeds end: {}
AI-assisted analysis of Zackriya-Solutions/meetily@a2cb62e827 (2026-09-12).
Data as JSON: /api/errors/8879dc1f99e99137.
Report an issue: GitHub.