Description
I (and other administrators) keep getting the error "The backup file contains more than one top-level question categories for context 45443." We're trying to import a single topic and all its contents into 2nd Course from 1st Course. In this case, 1st Course is a course restored from Moodle 3.11. It was restored as a new course. 2nd Course is a course that was restored from 1st Course, but not including Topics. This appears to be occurring on 2nd Course only, when importing from 1st Course. It's also occurring when attempting the same import to 2nd Course, but from 3rd Course. Note that 3rd Course in this example was also originally restored as a new course from 1st Course at the beginning of the school year.
I've already purged caches but have not restarted the server yet. I'll do that when traffic is low. It seems like the category IDs were messed up somewhere along the way.
This error is rather urgent. I am going to upgrade Moodle and my servers tonight, but I still wanted to put this error in, since it's preventing students from working on assignments that are supposed to be due by the end of the week, and I'm not really behind in Moodle updates at least (I am a little behind on Ubuntu updates, though...). Please help!Error
The backup file contains more than one top-level question categories for context 45443.Apache2 error logs (/var/log/apache2/error.log)
Note that no logs are generated at the time the error is viewed in the course. It usually took a couple of minutes for "Invalid course module ID" log to show up in the logs, so I'm only assuming that's one of the error logs in question.
[Tue Sep 20 15:28:17.480538 2022] [php7:notice] [pid xxxxxx] [client xx.xxx.xx.xx:xxxxx] Default exception handler: Invalid course module ID Debug: \nError code: invalidcoursemodule\n* line 497 of /lib/setuplib.php: moodle_exception thrown\n* line 43 of /mod/page/view.php: call to print_error()\n
[Tue Sep 20 16:15:13.147143 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] instantiating restore controller b2e7f416ecd116a646d2896c011293ec, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.149248 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] setting controller status to 100, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.151153 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] loading backup info, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.154346 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] loading controller plan, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.165485 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] setting controller status to 300, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.167263 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] applying restore defaults, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.169701 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] Unknown setting: questionbank, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.171779 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] setting controller status to 400, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.173385 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] checking plan security, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.174817 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] setting controller status to 500, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.176331 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] setting controller status to 600, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.177847 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] saving controller to db, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.179509 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] calculating controller checksum 09d3989236d76594788906d07263145b, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:15:13.190973 2022] [php7:notice] [pid xxxxxx] [client yyy.yy.yyy.yyy:yyyyy] loading controller from db, referer: https://flip.funlearningcompany.com/backup/import.php
[Tue Sep 20 16:35:27.329202 2022] [php7:notice] [pid yyyyyy] [client zz.zzz.zz.zz:zzzzz] Default exception handler: Invalid course module ID Debug: \nError code: invalidcoursemodule\n* line 497 of /lib/setuplib.php: moodle_exception thrown\n* line 33 of /mod/hvp/view.php: call to print_error()\n
[Tue Sep 20 17:09:02.232840 2022] [php7:notice] [pid zzzzzz] [client zz.zzz.zz.yyy:xyzxy] Default exception handler: Invalid course module ID Debug: \nError code: invalidcoursemodule\n* line 497 of /lib/setuplib.php: moodle_exception thrown\n* line 38 of /mod/quiz/view.php: call to print_error()\n
Environment
Web server: Moodle 4.0.3+ (Build: 20220826)
Web server: Ubuntu 20.04.5 LTS (GNU/Linux 5.15.0-1017-aws x86_64)
DB server: Ubuntu 20.04.4 LTS (GNU/Linux 5.15.0-1017-aws x86_64)
PHP 7.4.3 (cli) (built: Jun 13 2022 13:43:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2022-06-14T13:30:55
Our Moodle is across two servers on a VPC with one public subnet (for web) and one private subnet (for db).
Reproduce
- Navigate to Home > [category_name] > [subcategory_1] > [subcategory_2] > 2nd Course> More > Course reuse
- Search for and select course, then click Continue.
- Select defaults in Import settings page, and click Next.
- Select all of one topic on the Include page, and click Next.
- Confirm Import settings, and click Perform import.
Both courses exists in the same main category but diverge after that and are contained within the same amount of subcategories in the tree:
Category
|--- School 1
| |--- Course type 1
| |--- 1st Course
|
|--- School 2
| |--- Course type 1
| |--- 2nd Course
Questions
- Any ideas on how to fix this error?
- Does it usually take a few minutes for error logs to get written?
- Am I even looking at the correct logs?
Image for reference


Thanks!