Skip to content

fix: qbt reuse existing torrent - #121

Open
benjitobz wants to merge 1 commit into
Chaptarr:developfrom
benjitobz:fix/qbt-reuse-existing-torrent
Open

fix: qbt reuse existing torrent#121
benjitobz wants to merge 1 commit into
Chaptarr:developfrom
benjitobz:fix/qbt-reuse-existing-torrent

Conversation

@benjitobz

Copy link
Copy Markdown

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:

  1. Grab a release in Chaptarr so its torrent lands in qBittorrent and completes.
  2. Remove the download history entry (or otherwise cause Chaptarr to re-grab the same release) while the torrent remains in qBittorrent.
  3. Before this change: the add call fails with qBittorrent's Fails response and the grab errors out. After: the existing torrent is adopted (logged as such) and the completed download imports normally.

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.

@benjitobz benjitobz changed the title Fix: qbt reuse existing torrent fix: qbt reuse existing torrent Sep 3, 2026
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
benjitobz force-pushed the fix/qbt-reuse-existing-torrent branch from 401ce46 to ff3d638 Compare September 3, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant