We are having a major issue with some sites restoring courses. Somehow the restoration process is resulting in a blank course record being created. This causes a category of 0 which then causes the SITEID to be the blank course (and thus breaks the whole moodle).
My suspicion is that it is related to the course restore taking a long amount of time and crashing. I am awaiting for some step-by-step reports from users which i'll post here to try and track this bug.
Edit: In the end I discovered this bug was caused by users restoring non-moodle backup zip files (scorm)