\core\task\tag_cron_task error context id does not exists

\core\task\tag_cron_task error context id does not exists

by Attilio Ferrari -
Number of replies: 0

Hello to all,
I have a problem with the task in question, it is a rather strange thing.
it is scheduled for 3 am and the first time always goes wrong because it says it does not find the contextid in the contexts table and this is the backtrace:
Backtrace:
* line 1575 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
* line 5299 of /lib/accesslib.php: call to moodle_database->get_record()
* line 221 of /lib/classes/event/base.php: call to context::instance_by_id()
* line 96 of /lib/classes/event/tag_removed.php: call to core\event\base::create()
* line 268 of /lib/classes/task/tag_cron_task.php: call to core\event\tag_removed::create_from_tag_instance()
* line 209 of /lib/classes/task/tag_cron_task.php: call to core\task\tag_cron_task->bulk_delete_instances()
* line 51 of /lib/classes/task/tag_cron_task.php: call to core\task\tag_cron_task->cleanup()
* line 163 of /admin/tool/task/cli/schedule_task.php: call to core\task\tag_cron_task->execute()


it is then automatically rescheduled for the next cron round and all goes well.
On the next spin he fails again and so on.
I tried to run the mysqlcheck but everything is ok, I started the context cleanup task and it is all successful, I don't come out, can you help me? Thanks 

Average of ratings: -