tonhowtf/omniget · error · anyhow::Error
not all segments completed
Error message
not all segments completed
What it means
After all worker tasks finish, download_chunked locks the segment table and verifies every segment's state flag equals SEG_DONE. If any segment is still pending/failed/in-progress, the part file is not complete and the library refuses to proceed to assembly. This is a post-join completeness invariant for the multi-segment download.
Solutions
- Inspect the segment states logged before this error to find which segment(s) did not reach SEG_DONE and why.
- Check whether first_err from worker failures was consumed earlier; make sure a failed segment always surfaces its error.
- Delete the stale .part file and retry the download so all segments start fresh.
- Fix the state machine so every worker exit path (success, failure, cancel) deterministically sets a terminal segment state.
Defensive patterns
Strategy: retry
Try / catch
// caller pattern
if let Err(e) = download(...).await {
if e.to_string().contains("not all segments completed") {
fs::remove_file(&part_path).ok(); // discard partial state, retry clean
}
} Prevention
- Always delete the stale .part file before retrying a failed chunked download.
- Ensure cancellations propagate a terminal state to every segment before joining.
- Log per-segment states at the end of download_chunked to make failures diagnosable.
When it happens
Trigger: Worker exits without marking its segment SEG_DONE: a segment failed and the error was recorded but first_err was somehow not propagated, a worker was aborted early (cancel path), or retry bookkeeping reset a segment state after its worker ended.
Common situations: Cancellations racing with completion, a worker that hit a fatal error which panicking tasks masked, or state-machine bugs where a segment stays in SEG_FAILED after exhausting retries while other workers finish normally.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Size mismatch: expected
- size mismatch: expected
- Track sem metadata pra resolver no YouTube
- download de falhou: HTTP
- nao foi possivel buscar
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/53b3be094326c7f7.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/http_fetcher.rs:567
}
}
progress_pump.abort();
if let Some(p) = resume_pump {
p.abort();
}
let _ = progress_pump.await;
if let Some(e) = first_err {
return Err(e);
}
let segs = segments.lock().await;
let all_done = segs
.iter()
.all(|s| s.state.load(Ordering::Relaxed) == SEG_DONE);
if !all_done {
return Err(anyhow!("not all segments completed"));
}
let actual = tokio::fs::metadata(part_path).await?.len();
if actual != total {
return Err(anyhow!(
"size mismatch: expected {} bytes, got {}",
total,
actual
));
}
Ok(())
}
}
struct ProbeResult {
content_length: Option<u64>,
accept_ranges: bool,
}View on GitHub (pinned to 8600b91f42)