fix: qbt reuse existing torrent - #121
Open
benjitobz wants to merge 1 commit into
Open
Conversation
Re-grabbing a release whose torrent already sits in qBittorrent made the add call fail with the clients bare Fails response and the grab errored out. When the add is refused, check whether that info-hash already exists in the client and, if so, continue with the existing download so the completed torrent imports normally. Genuine add failures still throw.
benjitobz
force-pushed
the
fix/qbt-reuse-existing-torrent
branch
from
September 3, 2026 20:06
401ce46 to
ff3d638
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Re-grabbing a release whose torrent already sits in qBittorrent made the grab fail: qBittorrent refuses the add with its bare Fails response, Chaptarr threw, and the release errored out even though the torrent was sitting right there in the client. Now, when an add is refused (both the magnet-link and torrent-file paths), Chaptarr checks whether that info-hash already exists in the client — if it does, it logs and continues with the existing download, so the torrent is adopted and imports normally. The existence check is done by hash comparison against the client's torrent list; genuine add failures (hash not present) still throw exactly as before, and explicit conflict rejections are untouched.
I came across this a lot when migrating to Chaptarr, was easier to just redownload some torrents and have Chaptarr deal with the files but pre-existing torrents would get stuck with the following. Nothing was wrong with grabbed release / torrent the client just already had the torrent.
Fixes # (if applicable)
No open issue - fixes when grab fails when torrent already exists in qBittorrent
Database Migration
NO
How was this tested?
Docker (linux/amd64) on an Ubuntu server host, against a live qBittorrent instance.
Steps to reproduce the original bug:
Screenshots (UI changes only) - N/A
A note on AI: We know AI/agentic coding is everywhere and only getting
more popular. We won't insist that you disclose whether you used it or which
models you used, but in the same spirit, please don't take offense if your PR
is scrutinized and changes are requested.
Review time: The longer the PR and the more lines changed, the longer the
review will take. Small, focused PRs merge fastest. If yours is big, please be
patient.