Resetting courses for year end and one of my last courses to reset threw the Invalid course module ID error after hitting the Reset Course button. I found several posts however none really pointed me to a fix. Here is the info from the logs:
Error code: invalidcoursemodule
* line 236 of \lib\modinfolib.php: moodle_exception thrown
* line 1860 of \lib\modinfolib.php: call to course_modinfo->get_cm()
* line 206 of \mod\assign\locallib.php: call to cm_info::create()
* line 83 of \mod\assign\lib.php: call to assign->__construct()
* line 5692 of \lib\moodlelib.php: call to assign_reset_userdata()
I was hoping I would be able to query the database, pull data from the proper tables to find this missing ID, and hopefully remove it.
I was able to restore the course as a new course and it doesn't throw that error when I Reset. At this point I don't need the course that's throwing the error anymore however it throws the same error when trying to delete it, much like others reported. Even though I have the course recreated, I would still like to not leave this issues hanging out there and recycle this course.