{"record":{"id":"cea192321a7aaecc","repo":"tonhowtf/omniget","slug":"torrent-download-failed-mod","errorCode":null,"errorMessage":"Torrent download failed: {}","messagePattern":"Torrent download failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/magnet/mod.rs","lineNumber":270,"sourceCode":"                        );\n                        // Fallback: detect completion from stats when\n                        // wait_until_completed() doesn't resolve\n                        if downloaded >= total {\n                            tracing::info!(\"[magnet] download complete from stats (id={})\", torrent_id);\n                            break;\n                        }\n                    }\n                }\n                _ = cancel_rx.cancelled() => {\n                    tracing::info!(\"[magnet] download cancelled, removing torrent id={}\", torrent_id);\n                    if let Err(e) = session_for_cancel.delete(TorrentIdOrHash::Id(torrent_id), false).await {\n                        tracing::warn!(\"[magnet] failed to delete torrent on cancel: {}\", e);\n                    }\n                    anyhow::bail!(\"Download cancelled\");\n                }\n                res = &mut completion => {\n                    if let Err(e) = res {\n                        anyhow::bail!(\"Torrent download failed: {}\", e);\n                    }\n                    let _ = progress.send(ProgressUpdate::percent(100.0)).await;\n                    tracing::info!(\"[magnet] download complete (id={})\", torrent_id);\n                    break;\n                }\n            }\n        }\n\n        let (total_size, torrent_name) = managed_torrent\n            .with_metadata(|meta| {\n                let size = meta\n                    .info\n                    .iter_file_lengths()\n                    .ok()\n                    .map(|iter| iter.sum::<u64>())\n                    .unwrap_or_else(|| meta.file_infos.iter().map(|f| f.len).sum());\n                let name = meta\n                    .info","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/magnet/mod.rs#L252-L288","documentation":"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.","triggerScenarios":"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.","commonSituations":"Insufficient disk space in output_dir; dead torrents with zero available peers; read-only download folder; librqbit task panics on malformed metadata.","solutions":["Inspect the wrapped inner error for the root cause (storage vs network)","Check free disk space and write permissions on output_dir","Verify the torrent has active seeds/peers; try a different torrent","Upgrade librqbit if the failure looks like an internal panic"],"exampleFix":"// before\nsession_for_cancel.delete(TorrentIdOrHash::Id(torrent_id), false).await?;\n// after\nif let Err(e) = session_for_cancel.delete(TorrentIdOrHash::Id(torrent_id), false).await {\n    tracing::warn!(\"cleanup after failed torrent: {}\", e);\n}\nreturn Err(anyhow::anyhow!(\"Torrent download failed: {}; check disk space and seed availability\", e));","handlingStrategy":"try-catch","validationCode":"let free = fs2::available_space(output_dir)?;\nanyhow::ensure!(free > min_required_bytes, \"not enough disk space in {}\", output_dir);","typeGuard":null,"tryCatchPattern":"match download(...).await {\n    Err(e) if format!(\"{e:#}\").contains(\"Torrent download failed\") => {\n        warn!(\"torrent task failed: {e:#}; check disk and peers\");\n        // optionally retry with a different torrent source\n    }\n    other => other?,\n}","preventionTips":["Pre-check disk space and write permissions","Prefer torrents with active seeds","Retry once on transient network failures"],"tags":["torrent","librqbit","disk","network"],"backgroundTag":"http-error-response","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}