MODE-1844 - Improved error handling & recovery during startup, so that an exception does not leave the repository in inconsistent state