Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Simone Mura -
Number of replies: 14

Hi,

 My task "Download available H5P content types from h5p.org" has the following error:

Execute scheduled task: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task)
... started 12:55:01. Current memory use 16.0 MB.
... used 25 dbqueries
... used 24.53431892395 seconds
Scheduled task failed: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task),Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified.
Backtrace:
* line 1619 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
* line 291 of /h5p/classes/core.php: call to mysqli_native_moodle_database->update_record()
* line 215 of /h5p/classes/core.php: call to core_h5p\core->fetch_content_type()
* line 69 of /lib/classes/task/h5p_get_content_types_task.php: call to core_h5p\core->fetch_latest_content_types()
* line 253 of /lib/cronlib.php: call to core\task\h5p_get_content_types_task->execute()
* line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
* line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
* line 178 of /admin/cli/cron.php: call to cron_run()


Dowbload only this H5P content Type
  • Accordion 1.0.28
  • Arithmetic Quiz 1.1.18
  • Chart 1.2.20
  • Collage 0.3.16
My Moodle is 4.0.1 (Build: 20220509)
DB mysql (8.0.29-0ubuntu0.22.04.2)
Php 7.4

How i can fix? please help!!!

Simone Mura

Average of ratings; -
In reply to Simone Mura

Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Ken Task -
Picture of Particularly helpful Moodlers

That task is more time consuming than most, so try this:

In code//admin/settings.php?section=systempaths
set path to php-cli (empty by default).
Is same path you used to php in setting up your cron job for the site.

In code/admin/tool/task/scheduledtasks.php
Look for the Download available h5p types from h5p.org
If you have the path to php-cli in paths of your site,
there will be a 'Run Now' link.
Click Run Now
It will take some time - to download and update records in DB ...  so be patient.

Just tested this and here is the output of that single job - note the time (*)

Execute scheduled task: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task)
... started 08:35:00. Current memory use 14.8 MB.
25 new content types installed
... used 14451 dbqueries
** ... used 69.232367992401 seconds
Scheduled task complete: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task)

'SoS', Ken



In reply to Ken Task

Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Simone Mura -
Hi Ken

I configured Path to PHP CLI and i click 'Run Now' in "Download available h5p types from h5p.org" but i've the same erro

Execute scheduled task: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task)
... started 16:35:21. Current memory use 14.3 MB.
... used 25 dbqueries
... used 21.02529501915 seconds
Scheduled task failed: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task),Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified.
Backtrace:
* line 1619 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
* line 291 of /h5p/classes/core.php: call to mysqli_native_moodle_database->update_record()
* line 215 of /h5p/classes/core.php: call to core_h5p\core->fetch_content_type()
* line 69 of /lib/classes/task/h5p_get_content_types_task.php: call to core_h5p\core->fetch_latest_content_types()
* line 253 of /lib/cronlib.php: call to core\task\h5p_get_content_types_task->execute()
* line 167 of /admin/cli/scheduled_task.php: call to cron_run_inner_scheduled_task()
In reply to Simone Mura

Re: Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Ken Task -
Picture of Particularly helpful Moodlers

From an ssh shell session on your server:

cd admin/tool/task/cli

then execute the clean up for h5p

php schedule_task.php --execute="\core\task\h5p_clean_orphaned_records_task"

That will complain but should complete:

++ admin/tool/task/cli/schedule_task.php is deprecated. Please use admin/cli/scheduled_task.php instead. ++
* line 39 of /admin/tool/task/cli/schedule_task.php: call to debugging()
Execute scheduled task: Unused H5P files cleanup (core\task\h5p_clean_orphaned_records_task)
... used 8 dbqueries
... used 0.014983177185059 seconds
Scheduled task complete: Unused H5P files cleanup (core\task\h5p_clean_orphaned_records_task)

Then run it again as it recommends from admin/cli/

php scheduled_task.php --execute="\core\task\h5p_clean_orphaned_records_task"

The diff there is in /admin/tool/task/cli/ the script is called schedule_task.php

now with new version of moodle /admin/cli/ its scheduled_task.php ... added the 'd'.

If we get the same errors, related to DB then could have something to do with the user configured for the DB - privs - to write to records?

If you know the superuser creds (root/and password), one could comment out lines for DB user/pass in main config.php, then add them back only using super user creds.    Then run script again.

I'm running 4.0.1+ (Build: 20220519) but using 5.7.37 of MySQL still so I can run some older versions of supported Moodle.

You might still end up having to report this in tracker. :|

Again... try above ... good luck!

'SoS', Ken


Average of ratings;Useful (1)
In reply to Ken Task

Ri: Re: Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Simone Mura -
Sorry Ken but is not resolved ;)

I made new installation and i've the same problem.
The problem is with H5P.Column

i made little debuger in the line 292 $DB->update_record('h5p_libraries', $params);

$params is
Array
(
[id] =>
[example] => https://h5p.org/column
[tutorial] => https://h5p.org/tutorial-column
)

Now i download 4.0.1+ and i'll test.
In reply to Simone Mura

Ri: Re: Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Simone Mura -
I've the same erro with Moodle 4.0.1+

My server is t2.micro in AWS
In reply to Simone Mura

Ri: Re: Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Simone Mura -
I've the same erro with Moodle 4.0.1+
the problems is with H5P.Column

Debug
core_h5p\core->fetch_content_type()
Input:
$library = Array
(
[machineName] => H5P.Column
[majorVersion] => 1
[minorVersion] => 13
[patchVersion] => 1
[example] => https://h5p.org/column
[tutorial] => https://h5p.org/tutorial-column
)

$librarykey = "H5P.Column 1.13"

The line 278
$libraryid = $factory->get_storage()->h5pC->librariesJsonData[$librarykey]["libraryId"];

return $libraryid empty
In reply to Simone Mura

Re: Ri: Re: Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Daniel Ha -

Hi there,

same problem with moodle 4.0.1. here. Also I can't update or install anything in the h5p-hub*. Always getting an error about validation problems and missing libraries (see attachment).

Has someone already found a fix or workaround?


Scheduled task failed: H5P-Inhaltsarten von h5p.org herunterladen (core\task\h5p_get_content_types_task),Fehler in der Kodierung gefunden, den nur Programmierer/innen korrigieren können: moodle_database::update_record_raw() id field must be specified.
Backtrace:
* line 1619 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
* line 291 of /h5p/classes/core.php: call to mysqli_native_moodle_database->update_record()
* line 215 of /h5p/classes/core.php: call to core_h5p\core->fetch_content_type()
* line 69 of /lib/classes/task/h5p_get_content_types_task.php: call to core_h5p\core->fetch_latest_content_types()
* line 253 of /lib/cronlib.php: call to core\task\h5p_get_content_types_task->execute()
* line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
* line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
* line 178 of /admin/cli/cron.php: call to cron_run()
Edit: At least I solved the missing-library-error (see solution here). After that I was able to update the h5p-files by uploading the latest librarys manually. Columns updated, too. So maybe the automatic task will perform successful next time. I'll check it tomorrow.

Attachment errorupdating.PNG
In reply to Daniel Ha

Ri: Re: Ri: Re: Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Simone Mura -

Sorry Daniel i don't understand your solution sad

Where your download latest librarys? I dont find in h5p.org.

best regards

Simone

In reply to Simone Mura

Re: Ri: Re: Ri: Re: Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Juan Eliseo Carrasco Díaz -
I was able to workaround this problem by doing the following:

- Download the file summary-714.h5p through the following link: https://api.h5p.org/v1/content-types/H5P.Summary
- Into the Moodle, go to "Site administration"
- Scroll down a bit and click on "Manage H5P content types"
- Drag and drop the file and click on "Upload H5P content types"
- Now, click on "Server" -> "Tasks" -> "Scheduled tasks". Find "Download available H5P content types from h5p.org" task and "Run Now"

I hope it works for you!

Best regards!
Average of ratings;Useful (3)
In reply to Juan Eliseo Carrasco Díaz

Re: Ri: Re: Ri: Re: Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Andrey G. -
Thanks!!!
In reply to Juan Eliseo Carrasco Díaz

Re: Ri: Re: Ri: Re: Ri: Re: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Anthony M -
The workaround worked for me too! 

It took for me to run again the task 2 or 3 times but it finally worked.

----

- Before appliying the workaround I was getting this error after cliking "Run now" for the task...

Scheduled task failed: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task),Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified.


After applying the workaround I was getting another error...

Scheduled task failed: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task),Unknown exception related to local files (Can not fetch file form URL)


and after running the task one more time it finally worked...



Thanks a lot for the workaround Juan Eliseo!



In reply to Simone Mura

Ri: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Simone Mura -
RESOLVED

Before i downloaded an example of column H5p for h5p.org https://h5p.org/column

After in my course i add new activity h5p and in Package file i drop example of columun H5p.

This install content-type column h5p and relatives library. After i run the scheduled task and download other content-type.
Average of ratings;Useful (1)
In reply to Simone Mura

Re: Ri: Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Nimal Ratnayake -
Thanks. This workaround worked for me too.
In reply to Simone Mura

Moodle 4.0.1 & H5P: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi all,

There is a fix for this being processed at MDL-74895
Average of ratings;Useful (1)