This error occurs when you duplicate an activity or import activities.

We recently implemented master/slave mysql database.

This error occurs because it reads the backup_controller record too quick after insert the record.

The solution is just add

“sleep(1);”

before:

if (! $controllerrec = $DB->get_record(‘backup_controllers’, array(‘backupid’ => $backupid))) {
throw new backup_dbops_exception(‘backup_controller_dbops_nonexisting’);
}

in line 105, moodle/backup/util/dbops/backup_controller_dbops.class.php

and

 

in line 94, moodle/backup/util/dbops/restore_controller_dbops.class.php