Can't Manage Repositories Error

Re: Can't Manage Repositories Error

by David Morrow -
Number of replies: 0

Check the sky for flying pigs, because I may be able to help!

The instructions on this tracker item took care of my problem:

https://tracker.moodle.org/browse/MDL-38314:

1) SELECT contextid FROM mdl_repository_instances
WHERE NOT EXISTS (SELECT 'x' FROM mdl_context WHERE id = contextid);

2) That's the list of orphaned repositories in the site

3) DELETE FROM mdl_repository_instances WHERE contextid = xxxxx

note that the 1037 should appear in the list produced by 1).

My problem, by the way, was receiving a "Can not find data record in database table context." error when selecting "Manage Repositories. I could do as above and delete the filesystem repository from the server whenever I needed to access "manage repositories".

Using WebMin, I did the following:

  • Servers > MySQL Database Server
  • Selected moodle_csm database (Edit Database page loads)
  • From the "Edit Table" drop-down menu, selected "mdl_repository_instances"
  • On the resulting "Edit Table" page, tick the box beside "contextid"
  • Click "view data" button
  • Scan the "contextid" column and locate the number referenced as "xxxxx" in the above instructions ("WHERE contextid = 90797" in my case)
  • Tick the box at the far left of that line
  • Click "Delete selected rows"

My understanding is that this deleted an orphaned file repository instance, which is what was causing the error.

My entire debugging/ stack trace info was:

Manage repositories

Can not find data record in database table context.

More information about this error
Debug info: SELECT * FROM

{context}

WHERE id = ?
[array (
0 => '90797',
)]
Error code: invalidrecord
Stack trace:

line 1372 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
line 1348 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
line 5172 of /lib/accesslib.php: call to moodle_database->get_record()
line 323 of /admin/repository.php: call to context::instance_by_id()

I hope that this helps. It helped me that I recognized the repository instance that I wound up deleting.