Linux/Mono - Internal Server Error: /api/rootfolder

Any time I try and add a new series or search for a series to add I get “Internal Server Error: /api/rootfolder” with the following in the log. I’m using ubuntu 14.04 and mono 3.10. The files are stored in /data/media that I am attempting to search (local folder). Any ideas?

    System.IO.FileNotFoundException: Could not find file ""
  at System.IO.DriveInfo.GetDiskFreeSpace (System.String path, System.UInt64& availableFreeSpace, System.UInt64& totalSize, System.UInt64& totalFreeSpace) [0x00000] in <filename unknown>:0 
  at System.IO.DriveInfo.get_AvailableFreeSpace () [0x00000] in <filename unknown>:0 
  at NzbDrone.Mono.DiskProvider.GetAvailableSpace (System.String path) [0x00000] in <filename unknown>:0 
  at NzbDrone.Core.RootFolders.RootFolderService.Get (Int32 id) [0x00000] in <filename unknown>:0 
  at NzbDrone.Api.RootFolders.RootFolderModule.GetRootFolder (Int32 id) [0x00000] in <filename unknown>:0 
  at NzbDrone.Api.NzbDroneRestModuleWithSignalR`2[NzbDrone.Api.RootFolders.RootFolderResource,NzbDrone.Core.RootFolders.RootFolder].BroadcastResourceChange (ModelAction action, Int32 id) [0x00000] in <filename unknown>:0 
  at NzbDrone.Api.NzbDroneRestModuleWithSignalR`2[NzbDrone.Api.RootFolders.RootFolderResource,NzbDrone.Core.RootFolders.RootFolder].Handle (NzbDrone.Core.Datastore.Events.ModelEvent`1 message) [0x00000] in <filename unknown>:0 
  at NzbDrone.Core.Messaging.Events.EventAggregator.PublishEvent[ModelEvent`1] (NzbDrone.Core.Datastore.Events.ModelEvent`1 event) [0x00000] in <filename unknown>:0

Sounds like there is a bad entry in the root folders in the database, or drone is simply unable to get the free space (though the error is misleading in that case).

Which version of drone?
Were you able to add a series before?

Editing nzbdrone.db (sqlite) and clearing out the root folders is probably the quickest solution to getting it going again, you can get the path for it on System -> Info in drone (in the AppData folder).

There is only one folder /data in the RootFolders table and it exists and is owned by the correct user. I’m currently trying out the torrents branch 2122, but also tried with master branch 2064.

It adds the path correctly to the RootFolders table when I attempt to add ("/data/Shows") the directory. Though it returns a POST /api/rootfolder exception.

Also this exception occurs:

System.IO.FileNotFoundException: Could not find file ""
at System.IO.DriveInfo.GetDiskFreeSpace (string,ulong&,ulong&,ulong&) <0x00063>
at System.IO.DriveInfo.get_AvailableFreeSpace () <0x0003f>
at NzbDrone.Mono.DiskProvider.GetAvailableSpace (string) <0x001f7>
at NzbDrone.Core.RootFolders.RootFolderService.<AllWithUnmappedFolders>b__0 (NzbDrone.Core.RootFolders.RootFolder) <0x0006d>
at System.Collections.Generic.List`1<NzbDrone.Core.RootFolders.RootFolder>.ForEach (System.Action`1<NzbDrone.Core.RootFolders.RootFolder>) <0x0004b>
at NzbDrone.Core.RootFolders.RootFolderService.AllWithUnmappedFolders () <0x000cb>
at NzbDrone.Api.NzbDroneRestModule`1<NzbDrone.Api.RootFolders.RootFolderResource>.ToListResource<NzbDrone.Core.RootFolders.RootFolder> (System.Func`1<System.Collections.Generic.IEnumerable`1<NzbDrone.Core.RootFolders.RootFolder>>) <0x0001e>
at NzbDrone.Api.RootFolders.RootFolderModule.GetRootFolders () <0x00067>
at NzbDrone.Api.REST.RestModule`1<NzbDrone.Api.RootFolders.RootFolderResource>.<set_GetResourceAll>b__c (object) <0x0001a>
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Func`2<object, object>,object) <0x000a0>
at Nancy.Routing.Route/<>c__DisplayClass4.<Wrap>b__3 (object,System.Threading.CancellationToken) <0x00137>

Could you run mono with the --debug switch and drone with trace logging enabled and post the error message and surrounding log messages, need that info to track down the cause.

14-10-19 11:32:31.7|Trace|EventAggregator|Publishing ModelEvent
14-10-19 11:32:31.7|Trace|EventAggregator|ModelEvent -> RootFolderModule
14-10-19 11:32:31.7|Trace|Owin|
14-10-19 11:32:31.7|Trace|Owin|Attempting PUT to http://exceptron.azurewebsites.net/api/v1/
14-10-19 11:32:31.7|Trace|Owin|

14-10-19 11:32:32.3|Trace|Owin|
14-10-19 11:32:32.3|Trace|Owin|{“RefId”:“b5ba7b42”,“Ver”:“1.0.0.0”,“Errors”:null}
14-10-19 11:32:32.3|Trace|Owin|

14-10-19 11:32:31.7|Error|EventAggregator|RootFolderModule failed while processing [ModelEvent]

System.IO.FileNotFoundException: Could not find file “”

Need the exception from the error as well, so I can see the line numbers.

14-10-19 17:19:16.5|Trace|EventAggregator|Publishing ModelEvent<RootFolder>
14-10-19 17:19:16.5|Trace|EventAggregator|ModelEvent<RootFolder> -> RootFolderModule
14-10-19 17:19:16.5|Trace|Owin|
14-10-19 17:19:16.5|Trace|Owin|Attempting PUT to http://exceptron.azurewebsites.net/api/v1/
14-10-19 17:19:16.5|Trace|Owin|

14-10-19 17:19:17.0|Trace|Owin|
14-10-19 17:19:17.0|Trace|Owin|{"RefId":"b5ba7b42","Ver":"1.0.0.0","Errors":null}
14-10-19 17:19:17.0|Trace|Owin|

14-10-19 17:19:16.5|Error|EventAggregator|RootFolderModule failed while processing [ModelEvent<RootFolder>]

System.IO.FileNotFoundException: Could not find file ""
  at System.IO.DriveInfo.GetDiskFreeSpace (System.String path, System.UInt64& availableFreeSpace, System.UInt64& totalSize, System.UInt64& totalFreeSpace) [0x00000] in <filename unknown>:0 
  at System.IO.DriveInfo.get_AvailableFreeSpace () [0x00000] in <filename unknown>:0 
  at NzbDrone.Mono.DiskProvider.GetAvailableSpace (System.String path) [0x0008e] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Mono\DiskProvider.cs:36 
  at NzbDrone.Core.RootFolders.RootFolderService.Get (Int32 id) [0x0000d] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\RootFolders\RootFolderService.cs:144 
  at NzbDrone.Api.RootFolders.RootFolderModule.GetRootFolder (Int32 id) [0x00000] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Api\RootFolders\RootFolderModule.cs:38 
  at NzbDrone.Api.NzbDroneRestModuleWithSignalR`2[NzbDrone.Api.RootFolders.RootFolderResource,NzbDrone.Core.RootFolders.RootFolder].BroadcastResourceChange (ModelAction action, Int32 id) [0x00000] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Api\NzbDroneRestModuleWithSignalR.cs:38 
  at NzbDrone.Api.NzbDroneRestModuleWithSignalR`2[NzbDrone.Api.RootFolders.RootFolderResource,NzbDrone.Core.RootFolders.RootFolder].Handle (NzbDrone.Core.Datastore.Events.ModelEvent`1 message) [0x0001e] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Api\NzbDroneRestModuleWithSignalR.cs:33 
  at NzbDrone.Core.Messaging.Events.EventAggregator.PublishEvent[ModelEvent`1] (NzbDrone.Core.Datastore.Events.ModelEvent`1 event) [0x000c5] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\Messaging\Events\EventAggregator.cs:56 

14-10-19 17:19:17.1|Trace|NzbDroneErrorPipeline|Handling Exception
14-10-19 17:19:17.1|Trace|Owin|
14-10-19 17:19:17.1|Trace|Owin|Attempting PUT to http://exceptron.azurewebsites.net/api/v1/
14-10-19 17:19:17.1|Trace|Owin|

14-10-19 17:19:17.7|Trace|Owin|
14-10-19 17:19:17.7|Trace|Owin|{"RefId":"572c24dd","Ver":"1.0.0.0","Errors":null}
14-10-19 17:19:17.7|Trace|Owin|

14-10-19 17:19:17.1|Fatal|NzbDroneErrorPipeline|Request Failed

System.IO.FileNotFoundException: Could not find file ""
at System.IO.DriveInfo.GetDiskFreeSpace (string,ulong&,ulong&,ulong&) <IL 0x00019, 0x00063>
at System.IO.DriveInfo.get_AvailableFreeSpace () <IL 0x0000c, 0x0003f>
at NzbDrone.Mono.DiskProvider.GetAvailableSpace (string) [0x0008e] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Mono\DiskProvider.cs:36
at NzbDrone.Core.RootFolders.RootFolderService.Add (NzbDrone.Core.RootFolders.RootFolder) [0x000d1] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\RootFolders\RootFolderService.cs:100
at NzbDrone.Api.NzbDroneRestModule`1<NzbDrone.Api.RootFolders.RootFolderResource>.GetNewId<NzbDrone.Core.RootFolders.RootFolder> (System.Func`2<NzbDrone.Core.RootFolders.RootFolder, NzbDrone.Core.RootFolders.RootFolder>,NzbDrone.Api.RootFolders.RootFolderResource) <0x00042>
at NzbDrone.Api.RootFolders.RootFolderModule.CreateRootFolder (NzbDrone.Api.RootFolders.RootFolderResource) [0x00000] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Api\RootFolders\RootFolderModule.cs:43
at NzbDrone.Api.REST.RestModule`1<NzbDrone.Api.RootFolders.RootFolderResource>.<set_CreateResource>b__f (object) <0x00032>
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Func`2<object, object>,object) <IL 0x00038, 0x000a0>
at Nancy.Routing.Route/<>c__DisplayClass4.<Wrap>b__3 (object,System.Threading.CancellationToken) <IL 0x0005f, 0x00137>

Maybe you can also help me, I’m not normally a windows developer that uses VS. Trying to setup the project so it builds, I load the solution file in the src folder and when I build I get about 40 errors mostly related to “Metadata file … could not be found”. If you possibly have the time/I’m missing something simple it would be great if you could help me out. I like this app so I want to make it work haha.

Thanks for the logs, I pushed a fix to develop, if you’re able to test that would be great, otherwise it will hit master sometime in the future, hopefully in the next couple days.

Not sure, if you could pastebin the output from VS I might be able to figure it out, but right now I’m not sure what it could be.

How do I fix this error? It was working fine then all of a sudden I started to get this error. It happens when looking for where my tv shows are located when trying to add new shows.

@kewl4evr The top most post was on the exact same subject. Also need more info about drone version, mono version, OS and logs, an error message without logs is pretty much useless to us as there could be many causes.

Not to be stupid, but where and how do I get you this log?

System -> Logs -> Files in the UI or see: https://github.com/NzbDrone/NzbDrone/wiki/Log-Files

I’m interested in the error, I don’t need the full log just the error message and the log following it (though I suspect its the same as what was already posted).

I just took the time to reload program, everything is working fine again. Thanks for your time!

Got my build issues sorted. Cherry picked your commit on to the torrents branch and all is working :smile: