tonhowtf/omniget · info
Download cancelled
Error message
Download cancelled
What it means
In the completion loop, the cancellation token fired before the torrent finished. The code deletes the torrent from the session (best-effort) and then bails with this error to unwind the download. This is the deliberate user-abort path, not a malfunction.
Solutions
- Treat this error as a normal cancellation in the caller (match on message or use a typed cancel error)
- No remediation needed for the torrent — the code already deletes it from the session
- If unexpected, audit who owns the CancellationToken and whether it is cancelled too early
Example fix
// before
let res = downloader.download(...).await?;
// after
let res = match downloader.download(...).await {
Err(e) if format!("{e:#}").contains("Download cancelled") => return Ok(Cancelled),
other => other?,
}; Defensive patterns
Strategy: try-catch
Try / catch
match download(...).await {
Err(e) if format!("{e:#}").contains("Download cancelled") => info!("cancelled by user"),
other => other?,
} Prevention
- Model cancellation with a dedicated error type, not string matching
- Scope the CancellationToken to a single download task
When it happens
Trigger: cancel_rx.cancelled() resolves during the select! while the torrent download is in progress — user pressed stop, UI closed the task, or the app shut down.
Common situations: User cancels a slow torrent (few seeds); app exit while download running; a supervisor timeout cancelling long downloads.
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
- Download cancelled during session creation
- Download cancelled by user
- Send cancelled while waiting for receiver
- Send cancelled while paused
- Download cancelled
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/6cf5e0daea637e7d.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/platforms/magnet/mod.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)