tonhowtf/omniget · info
Download cancelled
Error message
Download cancelled
What it means
magnet.rs throws this in the download wait loop when the cancel token fires while the torrent is downloading. The select branch logs 'download cancelled', attempts to delete the torrent from the session (best-effort, failure only logged), and then bails with 'Download cancelled'. It is expected cancellation, not a torrent error.
Solutions
- Handle this message as normal user cancellation — stop and return silently rather than surfacing an error.
- If cancellation was unintended, trace who fired cancel_rx (UI, timeout, shutdown) for this download id.
- Verify the follow-up session.delete on cancel succeeded (a warn log 'failed to delete torrent on cancel' means cleanup leaked).
- Prefer a typed cancellation signal over string-matching the error message in calling code.
Defensive patterns
Strategy: try-catch
Try / catch
Err(e) if e.to_string() == "Download cancelled" => {
// normal path: torrent already deleted by the library; return quietly
Ok(DownloadOutcome::Cancelled)
} Prevention
- Use per-download tokens scoped to one attempt only
- Confirm the 'failed to delete torrent on cancel' warn is absent so state doesn't leak
- Surface cancellation as a status, not an error, in the UI
When it happens
Trigger: In the tokio::select! over progress/completion/cancel, `_ = cancel_rx.cancelled()` triggers at magnet.rs:266; the torrent (torrent_id) is deleted via session_for_cancel.delete(TorrentIdOrHash::Id(...), false) before bailing.
Common situations: User cancels a slow torrent download; app shutdown; the download manager cancels and re-queues a torrent; stalled torrent causes a supervisor to cancel the attempt.
Related errors
- No URL found in MediaInfo
- Download cancelled during session creation
- Torrent download failed
- Torrent was added in list-only mode
- Failed to add torrent
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/9bfe0f622e892cf5.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/platforms/magnet.rs:266
"[magnet] progress: {:.1}% ({:.1} MB / {:.1} MB)",
pct,
downloaded as f64 / 1_048_576.0,
total as f64 / 1_048_576.0,
);
// Fallback: detect completion from stats when
// wait_until_completed() doesn't resolve
if downloaded >= total {
tracing::info!("[magnet] download complete from stats (id={})", torrent_id);
break;
}
}
}
_ = cancel_rx.cancelled() => {
tracing::info!("[magnet] download cancelled, removing torrent id={}", torrent_id);
if let Err(e) = session_for_cancel.delete(TorrentIdOrHash::Id(torrent_id), false).await {
tracing::warn!("[magnet] failed to delete torrent on cancel: {}", e);
}
anyhow::bail!("Download cancelled");
}
res = &mut completion => {
if let Err(e) = res {
anyhow::bail!("Torrent download failed: {}", e);
}
let _ = progress.send(ProgressUpdate::percent(100.0)).await;
tracing::info!("[magnet] download complete (id={})", torrent_id);
break;
}
}
}
let (total_size, torrent_name) = managed_torrent
.with_metadata(|meta| {
let size = meta
.info
.iter_file_lengths()
.ok()View on GitHub (pinned to 8600b91f42)