I've seen this happen before but so far we haven't found the root cause of the issue. But the exception is caused by the system$userroles table in the database having ids that refer to users that no longer exist. Normally the ids in the association tables are also cleared out when users are rdeleted but it seems that something is broken here.
During update to 4.x all ids are being changed but this fails when there are incorrect associations in the system$userroles table.
If you are familiar with SQL you can check which user ids in the system$userroles table refer to users that aren't actually present in system$user and remove those.
Are you still able to open the project in the v3.3.1 modeler? If so, check that you do not have any empty rows in your Account or User table. If you do, delete them and try the upgrade again.
The error seems to be that the upgrade is trying to set a relationship between a Role and User record where the user record has no data. So this sounds like there are empty rows in your User table, which can happen if you tried to create new user records, then abandoned and the transaction was not properly rolled back. This situation is avoided in the new version because new records are now only created in memory before they are committed.