Error saving ID module course not valid

Hi,
I get this error:
ID de módulo de curso no válida
Debug info: SELECT id,course FROM {course_modules} WHERE id IS NULL
[array (
)]
Error code: invalidcoursemodule

Stack trace:
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 6817 of /lib/accesslib.php: call to moodle_database->get_record()
line 629 of /mod/hvp/classes/file_storage.php: call to context_module::instance()
line 443 of /mod/hvp/classes/file_storage.php: call to mod_hvp\file_storage->getFile()
line 262 of /mod/hvp/editor/h5peditor.class.php: call to mod_hvp\file_storage->cloneContentFile()
line 198 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processFile()
line 177 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processField()
line 218 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processSemantics()
line 177 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processField()
line 229 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processSemantics()
line 236 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processField()
line 177 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processField()
line 229 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processSemantics()
line 236 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processField()
line 177 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processField()
line 229 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processSemantics()
line 177 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processField()
line 218 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processSemantics()
line 145 of /mod/hvp/editor/h5peditor.class.php: call to H5peditor->processField()
line 161 of /mod/hvp/lib.php: call to H5peditor->processParameters()
line 109 of /mod/hvp/lib.php: call to hvp_save_content()
line 577 of /course/modlib.php: call to hvp_update_instance()
line 153 of /course/modedit.php: call to update_moduleinfo()

Output buffer: 
Notice: Trying to get property 'id' of non-object in /apps/www/html/moodledev/mod/hvp/classes/file_storage.php on line 629

This error happens when I edit a H5P.
Software version: moodle 3.5, H5P version 1.10.

After check to deep I found this:

 

 

"originalImage": {"path": "../2323/images/file-5a6f35f78bf23.png","mime": "image/png","height": 826,"width": 822}

 

Presents in the field jsoncontent and filtered of the table mdl_hvp.

 

The value "../2323/" is index correspond to database's index original because that course was created in other moodle.

Delete this attribute originalImage disappeare the error.

Any help, thank

thomasmars's picture

Hi, can you elaborate on the steps required to reproduce this bug ?
Also, have you tried this in the latest version (1.13) ?

Steps:

  1. Create backup course from a mooodle with H5P version 1.5
  2. Restore backup course in a moodle with H5P version 1.10
  3. Edit a activity H5P.

Test v1.13

I got the same error.

thomasmars's picture

Hi, I'm not able to reproduce this using the steps you have provided.
How does the error manifest ? Is the image not showing ? Is the content not showing ?

Can you provide the backup file for further debugging ?

Hi, 

we might have found same/similar case. It seems to refer to a image path inside h5p-packed that was restored from Moodle course backup as a new course, and inside h5p there is image path that referst to original course that seems to cause the give error when trying to safe any changes to the h5p in editor.

Broken path inside (that 1049 <- refers to original course ID which causes the problem):

"originalImage":{"path":"..\/1049\/images\/file-5e623799e3b30.png","mime":"image\/png","height":727,"width":1038}


Way to fix it is either change that path by hand inside that course backup (there is xml), or remove and then replace the image in question (if one somehow happens to knows what image causes it).

I have a broken packet as example, but problem is that it's a course presentation that 25Mb so I cannot attach it here.
I tried removing images and pages to make downloadable h5p smaller in size, but apparently that Invalid course module ID -error that happens while saving messes it up, so even if there is one page left that has the problem image, h5p is still 25Mb in size while apparently there is no other content in it, but it has not actually updated the content.

What would be preferable way to send it to you?