I got this same error. In my case, Moodle crashed and would not restart. I found that it could not write files in C:\server\moodledata\localcache and C:\server\moodledata\cache because of a permission error. Oddly enough, it was able to write to those directories before it crashed.
Since these are cache directories, I backed them up, renamed/deleted them, then restarted Moodle. It started fine.
I don't know the ramifications of doing this, or if this is an officially endorsed fix (probably not), but it did work for me.