tonhowtf/omniget · error

Torrent download failed

Error message

Torrent download failed: {}

What it means

The tokio JoinHandle for the torrent completion future resolved to Err, meaning librqbit's torrent download future itself failed (e.g. tracker errors, storage I/O failure, or the internal task panicked). The original error is wrapped with this context message.

Solutions

  1. Inspect the wrapped inner error for the root cause (storage vs network)
  2. Check free disk space and write permissions on output_dir
  3. Verify the torrent has active seeds/peers; try a different torrent
  4. Upgrade librqbit if the failure looks like an internal panic

Example fix

// before
session_for_cancel.delete(TorrentIdOrHash::Id(torrent_id), false).await?;
// after
if let Err(e) = session_for_cancel.delete(TorrentIdOrHash::Id(torrent_id), false).await {
    tracing::warn!("cleanup after failed torrent: {}", e);
}
return Err(anyhow::anyhow!("Torrent download failed: {}; check disk space and seed availability", e));
Defensive patterns

Strategy: try-catch

Validate before calling

let free = fs2::available_space(output_dir)?;
anyhow::ensure!(free > min_required_bytes, "not enough disk space in {}", output_dir);

Try / catch

match download(...).await {
    Err(e) if format!("{e:#}").contains("Torrent download failed") => {
        warn!("torrent task failed: {e:#}; check disk and peers");
        // optionally retry with a different torrent source
    }
    other => other?,
}

Prevention

When it happens

Trigger: The per-torrent completion future returned Err — disk full or permission denied while writing pieces, all trackers/DHT peers unreachable causing librqbit internal failure, or a panic in the download task.

Common situations: Insufficient disk space in output_dir; dead torrents with zero available peers; read-only download folder; librqbit task panics on malformed metadata.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/cea192321a7aaecc. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/magnet/mod.rs:270

                        );
                        // 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()
                    .map(|iter| iter.sum::<u64>())
                    .unwrap_or_else(|| meta.file_infos.iter().map(|f| f.len).sum());
                let name = meta
                    .info

View on GitHub (pinned to 8600b91f42)