Tuesday, February 13, 2018

Stupid exception: Device is not ready – System.IOException .net

When installing a Sitecore implementation from an development server environment to my laptop I ran into an absolutely stupid error.
And it's great to have this kind of errors pop up from time to time even if you have been in the development world for so long and are still unable to fix it immediately.

So, what error did I get?

Device is not ready – System.IOException .net

That is right... Nothing at all related to Sitecore.
But then you start to doubt that as my stacktrace showed to Lucene

[IOException: The device is not ready.
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +1091
   System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) +1413
   System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) +92
   Sitecore.IO.FileUtil.EnsureFolder(String path) +128
   Sitecore.ContentSearch.LuceneProvider.LuceneIndex.CreateDirectory(String folder) +100
   Sitecore.ContentSearch.LuceneProvider.Sharding.LuceneShard.Initialize() +52
   Sitecore.ContentSearch.LuceneProvider.LuceneIndex.InitializeShards() +507
   Sitecore.ContentSearch.LuceneProvider.LuceneIndex.Initialize() +381
   Sitecore.ContentSearch.ContentSearchConfiguration.AddIndex(ISearchIndex index) +411

Sooo, at that moment you start to re-check about everything. Rights and access, IIS configuration on the applicationpool.

I had gone as far as grant Everyone access to make sure rights&access had nothing to do with this error.

And then it obviously hit me:
Something must have been copied over linking to an external drive that is not available or accessible from my device. And since I no longer have a D drive in my machine that made perfect sense :)

So finally the problem turned out to be exactly that:
<sc.variable name="dataFolder" value="D:\inetpub\wwwroot\Project\Data"/>

--> I'll skip the part here where due to admin rights and a bad text editor (or the usage thereof), this soap continued for a while (as it mimicked the save execution, but didn't save it, nor did it return the D:\ reference in the search results anymore.... but as I said... Let me skip that part.

Stupid error but I just had to write this in order to vent some frustration :)