I have reported an issue here in this tracker MDL-77779 in which any course from 3.x which has course competencies that have been assigned to activity modules will produce a fatal error when the course is restored to a 4.1 site. The error you will see starts as:
Warning: Undefined property: stdClass::$overridegrade in /path/to/moodle//backup/moodle2/restore_stepslib.php on line 3752
Debug info: overridegrade: Data submitted is invalid
Error code: invalidpersistenterror
This is caused, as explained in the tracker, by a new setting added to 4.1 to allow teachers to manually override a competency rating awarded by activity completion (which is a good thing!). The restore does not properly handle this difference. This happens when you have imported the competency set to Moodle 4.1.
In the tracker I have also posted a code fix for this as well.