Course Import fails on random_question_loader issue

Course Import fails on random_question_loader issue

by Christe McMenomy -
Number of replies: 2

Systems: AlmaLinux (production) Mac OS Ventura (test)

Moodle 5.0.1 downloaded July 17 most recent build

I have upgraded from 4.5.1 to 5.0.1, partly to resolve the problems introduced to the question bank last year.  In 4.5.1, attempts to import courses for the coming 2025 year were failing due to question_bank issues. After upgrading, most courses import successfully (some with notices that questions are being moved to different categories in the new shared category pool). All cron ad_hoc jobs have completed to modify the question bank following the upgrade.

However, a course which is being imported from two years previous (and so did not suffer the 4.4+ import issues) is now reporting the following error:core_question bank error message

I was not able to find any reference to this particular issue online, so it may be peculiar to this course and quiz. 

Any suggestions on how to approach the problem? Is there a way to determine which specific questions are causing the error?  I have no problem using the 5.0.1 Moodle admin reports to remove questions (esp. if not used recently), or phpmyadmin to delete questions from the appropriate tables if they are corrupt, but I don't know what to look for in this case.

Average of ratings: -
In reply to Christe McMenomy

Course Import fails on random_question_loader issue

by Christe McMenomy -
Additional information:
Since the error occurs in the backup segment of the import from previous year, I ran just the backup on that course.

cron.php is reporting this as a potential coding error:
Adhoc task custom data: {"backupid":"bae75a82b044030c9aeba12953958ae8"}
... started 12:50:09. Current memory use 47.9 MB.
Processing asynchronous backup for backup: bae75a82b044030c9aeba12953958ae8
loading controller from db
setting file inclusion to 1
setting controller status to 800
saving controller to db
calculating controller checksum 7fd7041130a06a7b4756400aa51d2f22
loading controller from db
PHP Warning: Undefined array key "filter" in /Users/christe/Sites/scholarsonlineorg/public_html/ScholarsOnline/moodle/backup/moodle2/backup_stepslib.php on line 311

Warning: Undefined array key "filter" in /Users/christe/Sites/scholarsonlineorg/public_html/ScholarsOnline/moodle/backup/moodle2/backup_stepslib.php on line 311
... used 1184 dbqueries
... used 1.2673139572144 seconds
... used 68.0 MB peak memory
Adhoc task failed: core\task\asynchronous_backup_task,core_question\local\bank\random_question_loader::get_filtered_question_ids(): Argument #1 ($filters) must be of type array, null given, called in /Users/christe/Sites/scholarsonlineorg/public_html/ScholarsOnline/moodle/question/classes/local/bank/random_question_loader.php on line 491
Backtrace:
* line 491 of /question/classes/local/bank/random_question_loader.php: call to core_question\local\bank\random_question_loader->get_filtered_question_ids()
* line 311 of /backup/moodle2/backup_stepslib.php: call to core_question\local\bank\random_question_loader->get_filtered_questions()
* line 62 of /mod/quiz/backup/moodle2/backup_quiz_stepslib.php: call to backup_questions_activity_structure_step->annotate_set_reference_bank_entries()
* line 95 of /backup/util/plan/backup_structure_step.class.php: call to backup_quiz_activity_structure_step->define_structure()
* line 199 of /backup/util/plan/base_task.class.php: call to backup_structure_step->execute()
* line 242 of /backup/moodle2/backup_activity_task.class.php: call to base_task->execute()
* line 191 of /backup/util/plan/base_plan.class.php: call to backup_activity_task->execute()
* line 145 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
* line 567 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
* line 70 of /lib/classes/task/asynchronous_backup_task.php: call to backup_controller->execute_plan()
* line 523 of /lib/classes/cron.php: call to core\task\asynchronous_backup_task->execute()
* line 302 of /lib/classes/cron.php: call to core\cron::run_inner_adhoc_task()
* line 128 of /lib/classes/cron.php: call to core\cron::run_adhoc_tasks()
* line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

Potential coding error - existing temptables found when disposing database. Must be dropped!
=========
So now I am not sure whether I am looking at a problem in the question bank or a problem with backing up a course with a random question.