Column 'library_id' cannot be null

Hi there,

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)