Sonarr not replacing existing episode with downloaded one

Sonarr version (exact version):
Mono version (if Sonarr is not running on Windows):
OS: Docker / Unraid 6.9.2
Debug logs: (trace log for specific file)
Description of issue:
Having an issue with replacing episodes with new copies. If it’s the first time an episode is grabbed, Sonarr imports it from QBit without issue, this error is only occurring when it tries to replace an existing episode, and it doesn’t happen with every episode either, some are replaced without issue, while others get the Destination Already Exists error. The mappings work fine as far as I am aware, since new episodes import without issue.

Specific error is NzbDrone.Common.Disk.DestinationAlreadyExistsException

Permissions Unraid for affected files are
previous file: 666 nobody users
new file: 666 nobody users

Permissions from within the Sonarr Docker container for affected files are
previous file: 666 abc users
new file: 666 abc users

I also ssh’d into the docker itself, and manually ran cp to copy the new file over the old file, and it worked without issue, so I don’t think it’s a permission issue either.

I did try googling for an answer, but couldn’t find anything that fit the problem I’m experiencing, so trying here to see if anyone has any ideas.

Looks like these logs are either for a subsequent failure (after a failed import where Sonarr either couldn’t clean up a partially imported file or something else caused it to fail in a way Sonarr didn’t handle).

At this point Sonarr is unaware there is already a file and won’t be aware until the series is rescanned at which point it should be able to import the file properly, but doesn’t explain how it got into this state in the first place.

so for testing purposes, I performed the following:
(Before your reply)

  1. Deleted the episode files (video, thumbnail, nfo).
  2. Waited for some time
  3. Checked status and found that the episode did import properly. It’s no longer showing under Activity, and the Status shows as the quality instead of an orange download icon.

Saw your reply then tried the following

  1. Selected “Refresh & Scan” at the top for the series
  2. Let it run. (No on screen indication that it had finished)
  3. Check this morning and the episode is still not imported, although this time due to “Not a preferred word upgrade for existing episode file(s)” - something which I have to investigate separately now.
    Seems like at least forward momentum since I’m not getting the DestinationAlreadyExistsException error anymore.

Given that I have two other series that are also experiencing the same “DestinationAlreadyExistsException” error, is there anyway to target or catch the preceeding issue where Sonarr is not detecting that a) it already removed the file rob b) detecting that it should have removed the file but didn’t?

If it was a previously failed import, you’ll have to track down the previous import failure, which should also be in the logs. If the file is ending up there some other way then it’d be a matter of tracking down how that’s happening.

in the case of tracking down previous import failure. Would that show up in Info logging, or do I have to leave Debug logging on for an extended time to try and track it down?

You’d need to leave debug logging enabled/trace logging enabled, but besides a bit more disk space used there shouldn’t be much of an impact with that.

I’ll leave debugging enabled and try to catch the next a file is left after Sonarr thinks it’s gone.