error/moodle/invalidcoursemodule
From MoodleDocs
The ID for the course module is invalid. Please contact the site admin.
For some unknown reason, this happens sometimes when deleting a user. Clicking the back button of the browser and deleting the user again, makes the deleting process continue and delete the user.
It can also happen when "Legacy course files" is enabled. Disabling this can solve the issue.
It can also happen when deleting a section. Amazingly, sometimes it fixes itself automatically when Cron runs a few times and you purge all caches...
But if the server does not fix itself, you can click on 'More > Course reuse > Backup' you can make a backup of such a course and restore it (in the same server or in another (local) server.