Column 'library_id' cannot be null

Hi there,

I'm re-posting the below from my colleague Ian - we would really appreciate your input:

After editing an H5P activity and saving, there is an error connecting to the Moodle database. 

This occurs when: 

> Changing the sizing of an image in H5P

> Unticking the "Require pass grade" option in H5P

> Changes to the completion settings (unticked the retry button on the quiz set and disabled the retry button) in H5P 

All of above is within H5P editor itself embedded into Moodle. 

 

After debugging, this is the error message: 

 

×Debug info: Column 'library_id' cannot be null

INSERT INTO mdl_hvp_contents_libraries (hvp_id,library_id,dependency_type,drop_css,weight) VALUES(?,?,?,?,?)

[array (

0 => '37753',

1 => NULL,

2 => 'preloaded',

3 => 0,

4 => 1,

)]

Error code: dmlwriteexception

×Stack trace:

line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown

line 1331 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()

line 1377 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()

line 1498 of /mod/hvp/classes/framework.php: call to mysqli_native_moodle_database->insert_record()

line 2263 of /mod/hvp/library/h5p.classes.php: call to mod_hvp\framework->saveLibraryUsage()

line 102 of /mod/hvp/classes/view_assets.php: call to H5PCore->filterParameters()

line 71 of /mod/hvp/classes/view_assets.php: call to mod_hvp\view_assets->getfilteredparameters()

line 44 of /mod/hvp/view.php: call to mod_hvp\view_assets->__construct()

 

Other important details:

Platform and version number: Moodle 3.8

Desktop or Mobile

Browser: All

H5P plugin version: 1.22.0

H5P content types where this occurs:  Fill in the Blanks,  Single Choice Set and Quiz (Question Set)

 

Thanks in advance!

Best,

Danika

Hey ! 

I have the same error at intereactive book on h5p. Any idea of the workaroud ? or the solution ?

Thanks

 

Hi Mikel!

No luck yet! As a workaround we have restored backups of the activities and are refraining from editing them again. Do you perhaps have any further feedback? Really hoping we can find a solution!

Thanks

Hi there. Same problem within my website in every H5P content module. Did you find a solution?

I've solved this issue here either by hidding duplicate content types or updating all of the content types.

Great to hear that! Could you write in a few simple steps what exactly did you do?

Hi! Great news! Could you please share the steps you took? 

Thank you !

Posted what we get on moodle.org: https://moodle.org/mod/forum/discuss.php?d=437815#p1762179. Appreciate any insight!

I have not experienced these issues (yet?), but am replying to some of the questions posted above. My responses are based on Moodle 3.11 and the core H5P plugin.

1) Perhaps another workaround could be to download the content, post-edit in Lumi, and re-upload to Moodle (course's Content Bank, activity's package area, or Atto's H5P embed, as pertinent) ?

2) Try to force download of the latest H5P packages from Scheduled tasks /admin/tool/task/scheduledtasks.php > Download available H5P content types from h5p.org (\core\task\h5p_get_content_types_task) - click on the "Run now" link
(assuming that such monthly syncs are turned on on your Moodle, and that the "Run now" option has not been disabled)

3) If you want to disable older / uneeded versions of H5P packages , go to "Manage H5P content types" (path: /h5p/libraries.php ) and close the eyes on the unneeded stuff - Mine are all turned on, however (I have 2-3 different versions of Column in some cases). - AFAIK this feature is not available below Moodle 3.11, however.

@Shem007, do you know the cause of this issue? Our teachers have been using H5P without any issue for over two years. This issue has been reported a week ago. It must have come with the Moodle core updates. The core has been successively update, not running Moodle 3.9.16 (Build: 20220822). There was no major upgrade for almost two years. The H5P version is mod_hvp 1.22.4 2022012000, as you can see, has not been touched since early February this year. Ref. https://moodle.org/mod/forum/discuss.php?d=437815#p1762179.

I don't really know... I was thinking that if your previous Moodle install was perhaps below 3.8 , then your H5P activities might have been added using the original external plugin, not the core plugin that first arrived with Moodle 3.8. But then Moodle 3.8 premiered in November 2019, almost three years ago, so maybe you had it two years ago. Still, it's worth a check what plugin you had and used back then, and what you are having now. Maybe your system now features both plugins, and there is a conflict? Can't help you beyond that, certainly the Moodle H5P forum is worth searching further, such as some earlier topics when a lot of people were on Moodle 3.8 and 3.9 and were discusing migrations and updates of their sites.

HTH.

@Shem007, to be clear, we are early adopters of H5P, starting in Moodle 3.5 (LTS), using the additional plug-in https://moodle.org/plugins/mod_hvp, the only thing available at that time. Yes, I know, Moodle core came up with its own H5P plug-in, the mod_h5pactivity. But as I was stressing in both forums, my issue arises with the additional plug-in (mod_hvp). Yes, on our Moodle, version 3.9 (LTS), no 3.8, we upgrade from LTS to LTS, the core plug-in mod_h5pactivity is there, but I am talking of old mod_hvp content now breaking. I hope, Moodle core plug-in mod_h5pactivity doesn't break the old plug-in mod_hvp. :(

Can't help you there, sorry if my responses were confusing / off-target. I probably reads your previous message too quickly.. Maybe you just need to migrate contents, though I know that the old plugin had (has?) features not (yet?) implemented in the core plugin. I'm not up-to-date on this, however... The Moodle H5P forum had some success and failure stories, you might want to dig into those..

@Shem007, do you know the cause of the problem? In my site teachers were using H5P elements for a long time without these problems. Probably it crept in with the updates during the summer break. I mean the updates in Moodle core, we are now at Moodle 3.9.16 (Build: 20220822).  The H5P is mod_hvp 1.22.4 2022012000, has not being changed since January and working flawlessly till around July.

To the moderator: This is a duplicate of my post 5 min later. I couldn't see this one after posting and created a new one. Please DELETE this!

My solution is:

  • first go to h5p libraries (mod/hvp/library_list.php) and update content type cache
  • then check the installed libraries and where you can, update the instances (upward arrow on the right)
  • maybe you would get errors sometime
  • then go to one of your courses and begin to add a new h5p content
  • when you select a content type you can see whether it's upgradeable
  • if yes then upgrade
  • go back to your libraries and upgrade your instances.

That solved my problem.