Serious Code Runner error when updating categories.

Serious Code Runner error when updating categories.

de Kenneth Johnson -
Número de respuestas: 4

Dear All

I was updating the categories in my CodeRunner Question Bank when I tried to add a new category I received the below message:

Coding error detected, it must be fixed by a programmer: Invalid context id specified context::instance_by_id()

More information about this error

I now cannot find any of my categories, and worryingly nor can I find the questions associated with those categories in the question bank. When I view questions in my existing assessment they do not let me save them again.

It appears as an error on the Moodle side. 

I'd appreciate it if someone would urgently come back to me for advice as I'm attempting to set an assessment for next week. Can an admin restore my question bank or give me steps on how to do this?

Best regards

Ken 

En respuesta a Kenneth Johnson

Re: Serious Code Runner error when updating categories.

de Richard Lobb -
Well, that does sound like a scary situation. But why are you saying it's a CodeRunner error? CodeRunner is just a question type and doesn't manipulate question categories.

You say you were adding a new category. Please provide as much detail as possible about what you were doing when "updating categories" and "adding a new category".

And what exactly do you mean by "It appears as an error on the Moodle side."? Do you have a screen shot or error traceback or other information to clarify?

The situation sounds so dire that I'm inclined to doubt it's real. I recall once panicking when everything had gone missing, only to discover that I had somehow switched into the student role. To make sure it's nothing weird like that I recommend shutting down everything: browser windows, browsers, then your PC itself. Reboot your PC. Open a new browser incognito window and check if the world is still all broken.

If so, post back with some more detailed information about the errors you're getting.

If you can open questions in your existing assessments, then the questions are clearly still there in the database. What error message do you get when you attempt to save them? Have you tried changing the category into which you save them?

If all else fails, and assuming your system is set to do at least nightly backups, it should be possible to restore the course to the state of the previous backup, but an dmin has to do that. I'm assuming you don't have Moodle admin rights?
En respuesta a Richard Lobb

Re: Serious Code Runner error when updating categories.

de Kenneth Johnson -

Thanks for your suggestions Richard -- I've tried reseting my machine and run in Incognito mode, with no luck.I am working with an admin of the Moodle site, who is also stumped.

It appears that the categories for all my questions in my quizzes I've made (with only Code Runner questions) have been removed. I've not deleted them, but they don't seem to exist now. I was adding a category at the time that this started. It looks like the top category was removed -- taking with it all subcategories.

As a result, I cannot see these questions in the question bank. 

When I open any quiz I can at least see each individual question -- I can edit etc, but when I try to save, I receive the error: 

Coding error detected, it must be fixed by a programmer: Invalid context id specified context::instance_by_id()

Can you tell me how to change the category of each of the questions -- that might resolve it, and I haven't figured out how to do it

Any other suggestions would be appreciated.

Best regards

Ken

En respuesta a Kenneth Johnson

Re: Serious Code Runner error when updating categories.

de Jenny Harlow -
It is a stressful situation for you Ken. As Richard says, it does not sound particularly like something specifically related to CodeRunner - more some kind of a tangle in the underlying Moodle database?

I wonder if your overall site is configured to do automatic backups. If so, maybe your Moodle admin can try restoring the course from the backup (restoring into a new course so that nothing is overwritten!). Then you might be able to have a look at how the question bank was structured and possibly be able to work out what could have gone wrong from there, as well as hopefully be able to get your questions from there by exporting and importing if needed? If it was me I'd be interested in looking at the question bank structure and then trying to see what might have happened to disrupt things.

Best of luck with it!

Jenny
En respuesta a Jenny Harlow

Re: Serious Code Runner error when updating categories.

de Richard Lobb -
I'm sorry to hear the situation really is as dire as you first said. Stressful indeed. I was about to suggest first trying to restore your course from a backup, but I see Jenny beat me to it. I agree with her that this doesn't sound like a CodeRunner-related problem.

My suggestion of saving questions to a different category doesn't work, sorry. That functionality is no longer present from within the question editor in Moodle 4.

It might be possible to get some sort of handle on what happened and to patch it using SQL commands, but hacking at the database is perilous and an absolute last resort. You must certainly back up the database before attempting any such operations. You'd want to look first at the question_categories and question_bank_entries tables.