-
Bug
-
Resolution: Cannot Reproduce
-
Minor
-
None
-
4.1.6, 4.2.3
-
MOODLE_401_STABLE, MOODLE_402_STABLE
We have received multiple reports from users who gets the following error in Dashboard and My courses (popup window error):
|
Error code: err_system
|
/lib/completionlib.php line 1646: moodle_Exception was thrown |
/lib/completionlib.php, line 1152: Call completed_info->internal_systemerror() |
Line 82 of /completion/classes/progress.php: Call completed_info->get_data() |
/course/classes/external/course_summary_exporter.php, line 210: Call to core_completion\progress::get_course_progress_percentage() |
Line 62 of /course/classes/external/course_summary_exporter.php: Call to core_course\external\course_summary_exporter::get_course_progress() |
Line 125 of /lib/classes/external/exporter.php: Calling core_course\external\course_summary_exporter->get_other_values() |
/course/externallib.php, line 3923: Call to core\external\exporter->export() |
Line? Unknown file: Calling core_course_external::{closure}()
|
/course/externallib.php, line 3924: Calling array_map() |
Line 261 of /lib/externallib.php: Call to core_course_external::get_enrolled_courses_by_timeline_classification() |
Line 81 of /lib/ajax/service.php: Call external_api::call_external_function() |
This appears to be from an activity with a completion condition set. We have not been able to replicate this using actions via UI, but using the stacktrace above, we have been able to recreate it using the steps below and manually editing records in the database:
- Create a course and enrol a student.
- Turn edit mode to On.
- Login to database server and check the following (example):
select id, shortname,cacherev from mdl_course where id=14;
[ RECORD 1 ]--------
id | 14
shortname | course7
cacherev | 1696460679
4. Add an assignment activity and set the following:
Completion tracking = Show activity as complete when conditions are met
tick Student must view this activity to complete it
tick Student must receive a grade to complete this activity
tick Student must make a submission
5. Save and go back to course.
6. Simulate the deletion of the assignment module, but was not completely deleted – this appears to be what is happening on "live" courses wherein we have seen the issue.
update mdl_course{_}modules set id=-108 where id=108;
7. At this point, the course cacherev would have changed.
select id, shortname,cacherev from mdl_course where id=14;
[ RECORD 1 ]--------
id | 14
shortname | course7
cacherev | 1697082505
8. Update the cacherev and use the previous value from step 3.
update mdl_course set cacherev=1696460679 where id=14;
UPDATE 1
9. Log in as student and visit your dashboard. See error.
10. Go to the course. See error attached.
11. Go to My courses. and on the Course overview block, select Future/past/in progress.. depending on your course and assignment setup.
stacktrace:
Unexpected error: course-module 108 could not be found on course 14
Error code: err_system
- line 1646 of /lib/completionlib.php: moodle_exception thrown
- line 1152 of /lib/completionlib.php: call to completioninfo->internalsystemerror()
- line 82 of /completion/classes/progress.php: call to completioninfo->getdata()
- line 210 of /course/classes/external/coursesummaryexporter.php: call to corecompletion\progress::getcourseprogresspercentage()
- line 62 of /course/classes/external/coursesummaryexporter.php: call to corecourse\external\coursesummaryexporter::getcourse_progress()
- line 125 of /lib/classes/external/exporter.php: call to corecourse\external\coursesummaryexporter->getother_values()
- line 3923 of /course/externallib.php: call to core\external\exporter->export()
- line ? of unknownfile: call to corecourseexternal::{closure}()
- line 3924 of /course/externallib.php: call to array_map()
- line 261 of /lib/externallib.php: call to corecourseexternal::getenrolledcoursesbytimeline_classification()
- line 81 of /lib/ajax/service.php: call to externalapi::callexternal_function()
work-around: Cache should be purge (php admin/cli/purge_caches.php). Then the error is gone.
Unfortunately, we are still not able to replicate reliably the conditions leading to a course module being deleted or missing, but for some reason, the course cacherev has not been updated at all, this gives a mismatch between the DB, cache, and what is in the UI, and manifests the errors above. But with the stacktrace, I was able to recreate the issue by forcing database record updates.
We are hoping that in the absence of reliable steps to replicate that a code to handle the scenario can be developed to address the issue.