Couldn't Import Episode The Handle is Invalid

A friend of mine keeps getting this error after a successful download (filename alphanumerics obfuscated). We can’t figure it out. Any thoughts?

Z:\ (which stores the download destination folder and the import folder) is a mapped network drive. The app is a running as a windows application (as opposed to service) and is ran on startup (included in the startup folder). I am able to successfully navigate Z:\ and able to add, delete, and modify files.

It seems to be happening on every import.

Message
Couldn’t import episode Z:\Sandbox\complete\Mer Uyhdw Rfgvwdr S03E01 Yuiu a Fyeplr Yhg Rfvbni 720p WEB-DL DD5 1 H 264-SA89\VOnwpBKbGRwKps5D7XBPRB1tzXxU4m7mNdU.mkv: The handle is invalid.

Exception
System.IO.IOException: The handle is invalid.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.__Error.WinIOError()
at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
at NzbDrone.Common.Disk.DiskProviderBase.MoveFile(String source, String destination, Boolean overwrite) in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 274
at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.TransferFile(EpisodeFile episodeFile, Series series, List1 episodes, String destinationFilename, Boolean copyOnly) in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\EpisodeFileMovingService.cs:line 127 at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.MoveEpisodeFile(EpisodeFile episodeFile, LocalEpisode localEpisode) in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\EpisodeFileMovingService.cs:line 65 at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeEpisodeFile(EpisodeFile episodeFile, LocalEpisode localEpisode, Boolean copyOnly) in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\UpgradeMediaFileService.cs:line 65 at NzbDrone.Core.MediaFiles.EpisodeImport.ImportApprovedEpisodes.Import(List1 decisions, Boolean newDownload, DownloadClientItem historyItem) in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\EpisodeImport\ImportApprovedEpisodes.cs:line 85

This error is coming from the .net framework and seems to be one thats thrown when it can’t figure out why its failing, I haven’t been able to find a lot of information on it.

Do you get the same issue if you use a UNC path instead of the mapped network drive?
What platform is hosting the share?
Is there authentication on the share?

We’ve tried adding the season using the UNC path in nzbdrone, but run into the same problem. Would try to update SABnzbd to use UNC, but it just changes it back to the mapped drive.

Here’s the full setup:
Synology NAS

  • Destination for processes TV Series
  • \[nas ip]\Videos\TV (subdirectories have series)

Host Win8.1 Machine

  • Hard drive has SABnzbd Folder
  • D:\Sandbox(incomplete,complete,etc)
  • Maps \[nas ip]\ to U: drive (can navigate using explorer just fine on machine. no issues here)

Guest Win8.1 VM

  • VMWare virtual running on host machine
  • Runs SABnzbd and Nzbdrone
  • VMWare shares host folders:
    Host “D:\Sandbox” maps to guest Z:\Sandbox\ or \vmware-host\Shared Folders\Sandbox\
    Host “U:\Videos” maps to guest Z:\Videos\ or \vmware-host\Shared Folders\Videos\

In the guest virtual, I can navigate to the shared locations just fine and interact with the files using mapped drive and unc path. Additionally SABnzbd downloads files just fine and CouchPotato (also running on the guest) is able to move files off to the NAS. When I am in NZBDrone, I can add existing episodes using both mapped and UNC paths.

The error only happens after SABnzbd finishes its download. NZBDrone can’t rename the episodes or move them. I just get this error no matter what.

The reason for the complicated setup is that the Host-Guest connection is NAT (not bridged) in order to isolate the guest OS.

In an attempt to rule out whether the source or the destination in the move is the issue:

For testing could you add a series/modify an existing so the storage is on the guest OS’s local disk and let it import from SAB running on the share. Then it would also be useful to set the drone factory to a local path on the VM, drop a file in there and rescan and let it sort the file to the share.

Have you tried doing a rename of 1 episode (make a copy of it to be safe)? Rename as in renaming an already sorted file, would sort of test #2 above as well.

Thanks for the suggestions!!

I found out that nzbdrone was able to get to the Sandbox share just fine (the hard disk), but was having trouble getting to the Videos share (the NAS folder).

I realized the setup was more complicated than it needed to be, and just mapped a drive to the NAS directly in the guest. Problem solved.