Files not accessible after sharing LDAP user was deleted

My nextcloud ist connected to an external LDAP server (MS AD). The following happens:

user1 shares files with user2
user1 ist deleted from the LDAP server and appears in the remnants table (php occ ldap:show-remnants)
user2 can’t access all his files until user1 is deleted from nextcloud with “php occ user:delete user1”. The logfile says “OC\User\NoUserException: user1 is not a valid user anymore”.

Is this a bug?

Ubuntu 16.04
Nextcloud 14.01

Sounds very much like a bug, yes. Would recommend to open an issue in the bug tracker.

We have the same issue, to fix the issue for a user you can remove the file from the database.

In the log you can find the fileid by logging in as the broken user and checking the log, Then remove it from the oc_filecache table. It is possible you need to repeat this for several files. I’ve had users with up to 4 file entries needing removal from the db.