Looking at that stack trace, this error is coming form the gradebook.
Moodle is trying to load something (a grade item) from the
database, and is finding two matching records when it is expecting to find one. That is going to take some debugging to work out.
If you can access the database then examining the output of
SELECT * FROM mdl_grade_items WHERE courseid = ...
might give some info about what is happening. (Don't know what could have caused your site to get into this state.)