V4 - imported download handling - deletes imported file every time

Sonarr version (exact version): 4.0.16.2944 (-ls303 by [linuxserver.io])
Mono version (if Sonarr is not running on Windows): .NET
Yes (6.0.13)
OS: Unraid 7.2.2, sonarr running in LS.io docker
Debug logs:
Description of issue:
My process is normal. torrents are sent to Qbittorrent, processed by sonarr, hardlinked to plex.

Sonarr History looks like this:
Item is grabbed.
After that imported.
“/downloads/torrent/_sonarr/ep1.mkv
Imported To
/downloads/Series/My Series/ep1.mkv”
And after that every time, the episode is deleted.
Reason: File was deleted to import an upgrade

Hardlinks are enabled, the episodes are monitored and shown as available in sonarr, moved to the right plex folder.
The files from the /torrent folder are deleted, only available are the unraid FS fuse files. After qbit docker restart, the fuse files are gone (as expected).

When I disable hardlinks and choose copy setting, it’s even worse. Files are copied to the right /series folder, and everything is removed from the /torrent folder. So right after download, everything is gone from the seeding folder.

My sonarr instance is very old, 8+ years I think. So lot of settings migration from v2 v3 i guess. It used to work ok, a long time ago. Not sure when did this go wrong. Normally fuse filesystem keeps it there for enough time, to not cause issues with seeding, but this is not the way it should be working.
No tags on this example series. Quality profile very basic, web 720p hdtv 720p web 1080p (in this order).

What would make sonarr delete an episode file from the /torrent folder right away (File was deleted to import an upgrade) when there is no upgrade, torrent stays in qbittorrent, episode is keept monitored, plex playback is fine.

Thanks for your input!

debug log:
2026-02-23 14:36:25.7|Debug|UpgradeMediaFileService|Removing existing episode file: [8019] A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv
2026-02-23 14:36:25.7|Debug|RecycleBinProvider|Attempting to send ‘/downloads/Series/_0day/A Knight of the Seven Kingdoms/A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv’ to recycling bin
2026-02-23 14:36:25.7|Info|RecycleBinProvider|Recycling Bin has not been configured, deleting permanently. /downloads/Series/_0day/A Knight of the Seven Kingdoms/A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv
2026-02-23 14:36:25.7|Debug|RecycleBinProvider|File has been permanently deleted: /downloads/Series/_0day/A Knight of the Seven Kingdoms/A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv
2026-02-23 14:36:25.7|Debug|EpisodeService|Detaching episode 17255 from file.
2026-02-23 14:36:25.7|Debug|SubtitleFileService|Deleting Extra from database for episode file: [8019] A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv
2026-02-23 14:36:25.7|Debug|OtherExtraFileService|Deleting Extra from database for episode file: [8019] A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv
2026-02-23 14:36:25.7|Debug|MetadataFileService|Deleting Extra from database for episode file: [8019] A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv
2026-02-23 14:36:25.7|Debug|EpisodeFileMovingService|Attempting to hardlink episode file: /downloads/torrent/_sonarr/A.Knight.of.the.Seven.Kingdoms.S01.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb/A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv to /downloads/Series/_0day/A Knight of the Seven Kingdoms/A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv
2026-02-23 14:36:25.7|Debug|DiskTransferService|HardLinkOrCopy [/downloads/torrent/_sonarr/A.Knight.of.the.Seven.Kingdoms.S01.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb/A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv] > [/downloads/Series/_0day/A Knight of the Seven Kingdoms/A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv]
2026-02-23 14:36:25.7|Debug|DiskProvider|Setting permissions: 777 on /downloads/Series/_0day/A Knight of the Seven Kingdoms/A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv
2026-02-23 14:36:25.7|Debug|EpisodeService|Linking [A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv] > [[17255]In the Name of the Mother]

But nothing was deleted from the /series folder. The files are still there, so it’s not even true, lol

Episode history in sonarr ui:
grabbed
downloaded successfully
picked up from download client
episode file deleted

Meanwhile it’s still in there in the target folder, shown in sonarr on the details screen under Path.
And sonarr throws Item in the Activity tab, as it can’t find the items to be imported from the client (again), as the files are not available. When I restart qbit, the torrent is error with 0% completed (as expected) and after 1 minute it’s gone from the sonarr activity. Every episode is OK in sonarr, even though it says in the history, episode was deleted due to upgrade. Plex is fine, qbit seeding is obviously not fine.
Any ideas?

For seeding torrents Sonarr only moves or copies files, which is what your logs show.

Sonarr can be setup to remove seeded torrents, but it doesn’t delete the files directly, it tells qbit to remove them.

Your logs show Sonarr removing a previously imported file, to import a new file, but don’t show anything being deleted from the torrents folder. The full log file (which should be uploaded and linked here as mentioned in the template), may show something more, but unless that torrent was no longer seeding (and paused/stopped) it wouldn’t have been removed by Sonarr.

hello,
First of all, thank you for your time, BUT
the torrent wasn’t removed. Only the file which was seeded. Qbit obviously doesn’t do that. It didn’t even register the file being gone, until there is somebody to upload to down the line. Could be 1 minute, could be 20 hours, etc.

This issue is probably not a normal process flow, something is wrong.
There was no upgrade in case of this series. This was the first version of the series/episode to be downloaded.
Why does sonarr say about the target folder:
File has been permanently deleted: /downloads/Series/_0day/A Knight of the Seven Kingdoms/A.Knight.of.the.Seven.Kingdoms.S01E05.In.the.Name.of.the.Mother.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv

100% this file wasn’t deleted, it’s still there. There was no upgrade (“File was deleted to import an upgrade”) As this was the first and only verion.
The only file, which was deleted, was the seeded one, and it wasn’t done by qbit.

So to recap, multiple things are wrong, and they are done by sonarr (I think!):
It thinks there is an upgrade, and says in the logs, that it must remove the original file, but doesn’t do that, only in the log.
Meanwhile when it imports the file (with hardlinks enabled), it removes the file from the seeded torrent, but doesn’t tell qbit.

So in summary “it imagines” an upgrade and deletes the wrong file, not from the target, but from the source folder.

I will upload the 4MB debug (dropbox) log, hopefully there is no api_key in it…
The example timestamp from the previous post is: 2026-02-23 14:36:25.7.

This example is for a whole season import, but it does the same for a single episode as well.

Thanks!

2026-02-23 16:22:55.4|Debug|DiskScanService|Scanning '/downloads/torrent/_sonarr/' for video files

This from your logs is very suspicious. This is not something Sonarr would be doing in a typical setup. Possibly done from Manual Import: Move Automatically a blackhole client pointed at that directory (conflicting with your qbit client) or something else accessing the API. Trace logs would show more information.

Likely related to this…

2026-02-23 14:36:25.8|Warn|TorrentBlackhole|[A.Knight.of.the.Seven.Kingdoms.S01.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb] Error occurred while trying to delete data from '/downloads/torrent/_sonarr/A.Knight.of.the.Seven.Kingdoms.S01.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb'.

[v4.0.16.2944] System.IO.IOException: Directory not empty : '/downloads/torrent/_sonarr/A.Knight.of.the.Seven.Kingdoms.S01.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb'
   at System.IO.FileSystem.RemoveDirectoryInternal(DirectoryInfo directory, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
   at System.IO.FileSystem.RemoveDirectory(String fullPath, Boolean recursive)
   at System.IO.Directory.Delete(String path, Boolean recursive)
   at NzbDrone.Common.Disk.DiskProviderBase.DeleteFolder(String path, Boolean recursive) in ./Sonarr.Common/Disk/DiskProviderBase.cs:line 323
   at NzbDrone.Core.Download.DownloadClientBase`1.DeleteItemData(DownloadClientItem item) in ./Sonarr.Core/Download/DownloadClientBase.cs:line 129

Why do you have both qbit and torrent blackhole configured? And pointed at the same directory?

You should immediately remove that Blackhole client.

The logs indicate there was an upgrade, Sonarr removed the existing file and imported a new file in it’s place. Likely related to the log entry above, though that’s logged after your imports and I didn’t see another one earlier in the logs. Looks like the “upgrade” (same release) came from your second download client.

Meanwhile when it imports the file (with hardlinks enabled), it removes the file from the seeded torrent, but doesn’t tell qbit.

Sonarr does not do that with seeding torrents when it’s talking to the download client. With a blackhole client there isn’t a client, just the file system, so it has nothing to talk to…

So in summary “it imagines” an upgrade and deletes the wrong file, not from the target, but from the source folder.

To be clear it’s not imaging an upgrade, it’s a parallel quality file (not a downgrade) so it imports it because it doesn’t know it’s the same file from the same source because it came from a different download client. It definitely deleted the destination file, it also seems to have deleted the source file due to the blackhole client, though the logs aren’t super clear on that.

1 Like

wow, yess.
I disabled blackhole.
I have blackhole as priority 4
deluge as priority 2
and qbit as priority 0. Just a backup, if one docker has issue…
but it makes no sense as i never had an issue with them for years. I just probably disable auto update of qbit, so don’t run into version whitelist problems.

The issue is probably that they are pointed at the same folder with blackhole
Now I disabled everything, and I will re-test everything.
Huge thanks, now it all makes sense :slight_smile:

1 Like