Editing Competencies - invalidrecord

Editing Competencies - invalidrecord

by Benjamin Greiner -
Number of replies: 5

hi there,

i use moodle 3.8.2+ (Build 20200312, latest Adaptable Theme) which is hosted on a Synology DS918+ with DSM 6.2.2. (Linux based OS). Apache 2.4.39 is set up as web server together with PHP 7.3.11 and a Maria DB 10.3.21 database (collation: utf8mb4_general_ci).

I now have the following problem: Creating a competence framework and adding a new competence is still running without errors. But as soon as I click on the newly added competence, an "invalidrecord" is displayed as an error message (see screenshot). The error can be reproduced at any time even when using the Boost theme. It is still possible to link the competence, e.g. to a course activity, but this has the consequence that the competence and the corresponding frame can no longer be deleted. 

After activating the debug mode, the following error message was output to the log file when the error was reproduced:

[10-Apr-2020 18:26:59 Europe/Amsterdam] Default exception handler: Datensatz kann nicht in der Datenbanktabelle external_functions gefunden werden Debug: SELECT * FROM {external_functions} WHERE name = ?

[array (

  0 => 'tool_lp_data_for_related_competencies_section',

)]

Error code: invalidrecord

  • line 1562 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
  • line 1538 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
  • line 73 of /lib/externallib.php: call to moodle_database->get_record()
  • line 185 of /lib/externallib.php: call to external_api::external_function_info()
  • line 79 of /lib/ajax/service.php: call to external_api::call_external_function()


I am relatively new to Moodle and have little experience with LAMP technologies, so I would be very grateful for help.

Attachment comp_error.jpg
Average of ratings: -
In reply to Benjamin Greiner

Re: Editing Competencies - invalidrecord

by Benjamin Greiner -

If I interpret the error message I posted correctly, the problem I describe seems to have certain analogies to the topic "Dashboard errors after upgrade 3.5.2 > 3.6.1" posted in this forum. 

A function called_tool_lp_data_for_related_competencies_section() cannot be found in the entries of the API documentation. The only entries with the suffix tool_lp_data_for_* are tool_lp_data_for_compentencies_manage_page, tool_lp_data_for_compentency_frameworks_manage_page, tool_lp_data_for_compentency_summary and tool_lp_data_for_course_compentcies_page. A corresponding query of "external_functions" with phpAdmin shows that there are no other entries in the database. 

Now the question arises, why the function tool_lp_data_for_compentcies() is not available. Did I make an error during the installation ? The installation itself did not cause any problems and Moodle does not show any problems in the server configuration. Except for the problem described above, Moodle runs smoothly. 

For further help I would be very grateful.


In reply to Benjamin Greiner

Re: Editing Competencies - invalidrecord

by Benjamin Greiner -
Hello,
Problem was a missing registration. Thanks again to Andreas for his help. A description of the solution (in german) can be found here: https://moodle.org/mod/forum/discuss.php?d=400387#p1615673
In reply to Benjamin Greiner

Re: Editing Competencies - invalidrecord

by Shirley Gregorczyk -
Picture of Particularly helpful Moodlers
Hello,
I found this thread trying to research an error I received when trying to display a competency within a student's Learning Plan. Unfortunately, my German is at the level needed to read the forum discussion above.
The competency is attached to four learning plans. In two of the learning plans the competency displays correctly, in the other two I receive the same error message.
Error code: invalidrecord
* line 1546 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
* line 1522 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
* line 5068 of /lib/accesslib.php: call to moodle_database->get_record()
* line 119 of /competency/classes/evidence.php: call to context::instance_by_id()
* line 157 of /admin/tool/lp/classes/external/user_competency_summary_exporter.php: call to core_competency\evidence->get_context()
* line 125 of /lib/classes/external/exporter.php: call to tool_lp\external\user_competency_summary_exporter->get_other_values()
* line 71 of /admin/tool/lp/classes/external/user_competency_summary_in_plan_exporter.php: call to core\external\exporter->export()
* line 125 of /lib/classes/external/exporter.php: call to tool_lp\external\user_competency_summary_in_plan_exporter->get_other_values()
* line 92 of /admin/tool/lp/classes/output/user_competency_summary_in_plan.php: call to core\external\exporter->export()
* line 1021 of /admin/tool/lp/classes/external.php: call to tool_lp\output\user_competency_summary_in_plan->export_for_template()
* line 228 of /lib/externallib.php: call to tool_lp\external::data_for_user_competency_summary_in_plan()
* line 59 of /lib/ajax/service.php: call to external_api::call_external_function()
SELECT * FROM {context} WHERE id = ?
[array (
0 => '1742',
)]

Any help would be appreciated.
Kind Regards
In reply to Shirley Gregorczyk

Re: Editing Competencies - invalidrecord

by Benjamin Greiner -

Hi Shirley,
Unfortunately, my knowledge is not sufficient to really help you with your problem.

As far as I know, the error message "invalidrecord" is generally generated by an incorrect entry in the SQL database. In my case, a missing plug-in called 'tool_lp' triggered the error message. The German thread you mentioned with Andreas is basically about how to manually install the missing plug-in without having to completely reinstall Moodle, which is definitely not the problem for you.

If I interpret your error message correctly (no guarantee, I'm a complete SQL noob smile), Moodle is looking for a "context" with ID 1742 in your database, but can't find it. It's all been a while, but I seem to remember that the "context fields" contain references to the competencies created in Moodle. However, I haven't the slightest idea what could be the cause of the missing entry.

Greetings,
Benny

Average of ratings: Useful (1)
In reply to Benjamin Greiner

Re: Editing Competencies - invalidrecord

by Shirley Gregorczyk -
Picture of Particularly helpful Moodlers
Hi Ben,
I appreciate the information you have shared, it is helpful.
Thank you so very much!
Kind Regard,
Shirley