Can't Manage Repositories Error

Can't Manage Repositories Error

by George Graham -
Number of replies: 6

When I go to Plugins->Repositories->Manage I get an error about not finding something in the constext table. Here is the debug coade:

Debug info: SELECT * FROM {context} WHERE id = ?
[array (
0 => '233399',
)]
Error code: invalidrecord
Stack trace:
  • line 1357 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
  • line 1333 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
  • line 5132 of /lib/accesslib.php: call to moodle_database->get_record()
  • line 504 of /repository/lib.php: call to context::instance_by_id()
  • line 50 of /repository/filesystem/lib.php: call to repository->__construct()
  • line 934 of /repository/lib.php: call to repository_filesystem->__construct()
  • line ? of unknownfile: call to repository::get_instances()
  • line 1047 of /repository/lib.php: call to call_user_func_array()
  • line 312 of /admin/repository.php: call to repository::static_function()

Any ideas? Thanks.

Average of ratings: -
In reply to George Graham

Re: Can't Manage Repositories Error

by George Graham -

Turned out to be a problem with the fileystem repository. I deleted it and readded the newer version and it solved the problem.

Average of ratings: Useful (2)
In reply to George Graham

Re: Can't Manage Repositories Error

by David Morrow -

George. Would you mind going into more detail? I have the same problem and the same stack trace. What did you delete, and from where? Any other details would be great.

We are running 2.4, but haven't applied the 2.4+ update. Is the newer version you mention part of 2.4+?

Thanks!

David Morrow

In reply to David Morrow

Re: Can't Manage Repositories Error

by George Graham -

I deleted the filesystem directory out of the repository folder and that allowed me back in. I then reinstalled a newer version of that repository and it worked. Basically, I went through and started deleting the repositories one by one until I could get in and manage them and then I copied them back in, except for the filesystem. Hope that helps.

Average of ratings: Useful (1)
In reply to George Graham

Re: Can't Manage Repositories Error

by David Morrow -

George - Thanks. Yes, it helps. But just to make sure I understand:

You removed the "filesystem" folder from the repository folder in the moodle code directory and that is what allowed you to be able to get to "Manage repositories", right? But this was not the first one you removed - you went through a process of removing a repository's folder (drop box, youtube, coursefiles, etc) and then checking to see if you could get to the Manage Repositories page, right? And it wasn't until you removed the filesystem directory that you could reach that page without an error, true?

The newer version of the filesystem repository - is that from the 2.4+ update? We havn't applied that update yet. We are at 2.4. Do you think updating to 2.4+ would also take care of things?

Sorry to be so thick! I just don't want to misinterpret. I appreciate all help!

Thanks,

David

In reply to David Morrow

Re: Can't Manage Repositories Error

by Michel Barria -

I have the same problem, the solution stated here is not clear. Could someone step by step could tell us what to do?

In reply to Michel Barria

Re: Can't Manage Repositories Error

by David Morrow -

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.