Throw an exception if the file system and the database are out of sync (see #5101)