Error invalidrecordunknown thrown when creating simple calculated question

Error invalidrecordunknown thrown when creating simple calculated question

S T -
回帖数:4

I just installed moodle 4.0.1 through cpanel. I tried creating a Simple Calculated Question and I got the error below. Any help would be greatly appreciated. Thank you!

Debug info: SELECT q.id, qc.id as category, q.parent, q.name, q.questiontext, q.questiontextformat,
q.generalfeedback, q.generalfeedbackformat, q.defaultmark, q.penalty, q.qtype,
q.length, q.stamp, q.timecreated, q.timemodified,
q.createdby, q.modifiedby, qbe.idnumber,
qc.contextid,
qv.status,
qv.id as versionid,
qv.version,
qv.questionbankentryid
FROM {question} q
JOIN {question_versions} qv ON qv.questionid = q.id
JOIN {question_bank_entries} qbe ON qbe.id = qv.questionbankentryid
JOIN {question_categories} qc ON qc.id = qbe.questioncategoryid
WHERE q.id = :id
[array (
'id' => 0,
)]
Error code: invalidrecordunknown

Stack trace:
  • line 1674 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
  • line 624 of /question/engine/bank.php: call to moodle_database->get_record_sql()
  • line 587 of /cache/classes/loaders.php: call to question_finder->load_for_cache()
  • line 1792 of /cache/classes/loaders.php: call to cache->get_implementation()
  • line 405 of /cache/classes/loaders.php: call to cache_application->get_implementation()
  • line 480 of /question/engine/bank.php: call to cache->get()
  • line 255 of /question/engine/bank.php: call to question_finder->load_question_data()
  • line 273 of /question/engine/bank.php: call to question_bank::load_question_data()
  • line 217 of /question/bank/editquestion/question.php: call to question_bank::load_question()
When I click continue, I get another set of errors:

Need to provide courseid or cmid to print_question.

More information about this error

Debug info:
Error code: missingcourseorcmid
Stack trace:
  • line 109 of /question/bank/editquestion/question.php: moodle_exception thrown

回复S T

Re: Error invalidrecordunknown thrown when creating simple calculated question

S T -
The error I reported above is on the server where my moodle is hosted. To make sure it's not some server issue, I just freshly installed moodle 4.0.1 on my personal laptop as well (I'm using Archlinux). I then created a new course, and then tried creating a simple calculated question. I got the same exact error. Again, this is a completely fresh install.

I then tried creating a Numerical question and I was able to create it without issues.

Any help would be greatly appreciated! Thank you in advance!
回复S T

Re: Error invalidrecordunknown thrown when creating simple calculated question

OK Heng -

I encounter the same problem using Moodle version 4 on MoodleCloud.

The quiz question type Simple Calculated simply doesn't work. 

I tried using just one variable {a} and even with no calculation with same answer {a}, the following error message is encountered:

Can't find data record in database.

It was working fine in Moodle version 3.8.

Or do I miss anything?

回复S T

Ri: Error invalidrecordunknown thrown when creating simple calculated question

Francesco Poletti -

Hello Community,

I'm experiencing the same issue.

It first took place when I upgraded from 3.11 to 4 the production server.

Now, for debug purposes, I fresh installed Moodle 4.0.2+ (Build: 20220714) but the error is still here.

The error happens for every simple calculated question when I click the generate button to get the sets of values.

The other types of question seems to work properly.

By the way, the simple calculated questions already present in the question bank of the production server work fine.

Thanks for every suggestion.

回复Francesco Poletti

Re: Ri: Error invalidrecordunknown thrown when creating simple calculated question

Leon Stringer -
Core developers的头像 Particularly helpful Moodlers的头像

It looks like the OP reported this as MDL-75065. There appears to be active development on resolving this, you can watch this bug and vote for it too.