by Khyam Shahzad.
Thanks for the post... The same situation occurred with one of our course and there was attendance module instance in wrong category that doesn't exist. I just updated the category ID for that and it worked
(BTW I did it from database)