rqbit icon indicating copy to clipboard operation
rqbit copied to clipboard

error adding torrent: File exists (os error 17)

Open milahu opened this issue 5 months ago • 2 comments

adding a torrent with POST /torrents fails with http status 400 and the response text

{"error_kind":"internal_error","human_readable":"error adding torrent: File exists (os error 17)","status":400,"status_text":"400 Bad Request"}

... when these cache files already exist

~/.cache/rqbit/{btih}.bitv
~/.cache/rqbit/{btih}.torrent

workaround: remove the cache files and retry adding the torrent

milahu avatar Oct 26 '25 18:10 milahu

@milahu what should be the behavior here?

  1. Return 200 without reading submitted torrent?
  2. Merge submitted torrent (eg. new trackers, maybe hybrid infohash) with existing torrent?
  3. Return a dedicated status code which is not an internal error?
  4. Something else?

angrynode avatar Nov 02 '25 15:11 angrynode

Merge submitted torrent (eg. new trackers, maybe hybrid infohash) with existing torrent?

yes, but this should be optional (default off)

qBittorrent → preferences → downloads → when duplicate torrent is being added

  • merge trackers to existing torrent: default off
  • ask for merging trackers when torrent is being added manually: default on

so POST /torrents should have a query parameter merge_trackers=true|false

Return a dedicated status code which is not an internal error?

maybe

with merge_trackers=false the human_readable message should be

-error adding torrent: File exists (os error 17)
+error adding torrent: torrent exists

milahu avatar Nov 02 '25 16:11 milahu