by Ken Task.
Welcome. Interesting. All I can tell ya I've said in the previous response - making edits to the backup's moodle_backup.xml file shared with you, the course restored without the error you are seeing.
Since this is really an app/addon you've programmed might I suggest moderator move this to the forum for developers cause I think this is a development question.
'spirit of sharing', Ken