Moodle 4.5.6 LTS
This is new site, started at around Moodle 4.5.2. When in any course one goes to > Participants > Enrol users and try to open the drop-down Select cohorts, it throws:
ELECT * FROM {context} WHERE id = ?
[array (
0 => 2971,
)]
Error code: invalidrecord
* line 1662 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
* line 1638 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
* line 482 of /lib/classes/context.php: call to moodle_database->get_record()
* line 330 of /customfield/classes/data_controller.php: call to core\context::instance_by_id()
* line 370 of /customfield/classes/data_controller.php: call to core_customfield\data_controller->get_context()
* line 89 of /customfield/field/text/classes/data_controller.php: call to core_customfield\data_controller->export_value()
* line 921 of /cohort/externallib.php: call to customfield_text\data_controller->export_value()
* line 418 of /cohort/externallib.php: call to core_cohort_external::get_custom_fields_data()
* line ? of unknownfile: call to core_cohort_external::search_cohorts()
* line 253 of /lib/external/classes/external_api.php: call to call_user_func_array()
* line 83 of /lib/ajax/service.php: call to core_external\external_api::call_external_function()
SELECT * FROM {context} WHERE id = ?
[array (
0 => 2971,
)]
Error code: invalidrecord
* line 1662 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
* line 1638 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
* line 482 of /lib/classes/context.php: call to moodle_database->get_record()
* line 330 of /customfield/classes/data_controller.php: call to core\context::instance_by_id()
* line 370 of /customfield/classes/data_controller.php: call to core_customfield\data_controller->get_context()
* line 89 of /customfield/field/text/classes/data_controller.php: call to core_customfield\data_controller->export_value()
* line 921 of /cohort/externallib.php: call to customfield_text\data_controller->export_value()
* line 418 of /cohort/externallib.php: call to core_cohort_external::get_custom_fields_data()
* line ? of unknownfile: call to core_cohort_external::search_cohorts()
* line 253 of /lib/external/classes/external_api.php: call to call_user_func_array()
* line 83 of /lib/ajax/service.php: call to core_external\external_api::call_external_function()
It must have started very recently, in the last couple of days. There were no changes from the system side. Can´t see anything suspicious in the Config changes.
The "external" is suspicious though, the users a manually authenticated, the site is not connected to any external enrolment system.
Oh, yes, there is a single Cohort custom field - of type Short text.