cannot delete course containing unknown question type

cannot delete course containing unknown question type

by Elton LaClare -
Number of replies: 3

I apologise if my question is not one that ought to be dealt with in the quiz forum, but here it goes anyway...

Over time I've added a lot of 3rd party question types to my institution's Moodle. One such question type was Drag and Drop Matching (ddmatch). Because this question type didn't work especially well on small and touch-screen devices, I asked our Moodle support provider not to install the question type following our latest update (3.1). 

At a later point, I attempted to delete courses that contained quizzes with the Drag and Drop Matching question type and got the following error:

Coding error detected, it must be fixed by a programmer: Unknown question type ddmatch

I deleted the Drag and Drop Matching questions from the question bank, removed them from the quizzes, and deleted the quizzes for good measure. However, I am still unable to delete any courses that once contained ddmatch questions.

Do you have any suggestions? 

Average of ratings: -
In reply to Elton LaClare

Re: cannot delete course containing unknown question type

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Un-installed quetion types should not prevent you from deleting a course. This is a bug.

It would be helpful if you could briefly set Debugging to Developer level, trigger the error again, and copy and paste the full error message here. Thanks.

In reply to Tim Hunt

Re: cannot delete course containing unknown question type

by Elton LaClare -

I apologise for the slow reply. I've investigated a little more thoroughly and have some extra information to add. In my first post I mentioned that a course could not be deleted even after the missing question type had been removed from the quizzes. This turned out not to be true. While I thought I had removed all instances of the missing question type from the quizzes, I later discovered that this was not the case. I can now confirm that if all instances of a missing question type are removed from quizzes, it is possible to delete both the affected quiz and the entire course. That said, I think what I experienced with the ddmatch question type might still constitute a minor bug. For this reason I followed up on Tim's request and replicated the issue with debugging enabled. Here is what I got back...

Debug info: 
Error code: codingerror

Stack trace:

  • line 95 of /question/engine/bank.php: coding_exception thrown
  • line 563 of /lib/questionlib.php: call to question_bank::get_qtype()
  • line 512 of /lib/questionlib.php: call to question_move_questions_to_category()
  • line 292 of /lib/questionlib.php: call to question_save_from_deletion()
  • line 406 of /lib/questionlib.php: call to question_category_delete_safe()
  • line 529 of /lib/questionlib.php: call to question_delete_context()
  • line 4818 of /lib/moodlelib.php: call to question_delete_activity()
  • line 4704 of /lib/moodlelib.php: call to remove_course_contents()
  • line 67 of /course/delete.php: call to delete_course()

I hope this is of some help. Thank you for your time.


In reply to Elton LaClare

Re: cannot delete course containing unknown question type

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Thanks. That is very helpful. I think I see what is going on. I created MDL-57865.