Error: "Username is invalid because files already exist for this user"

Nextcloud version (eg, 20.0.5): 22.2.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04 Focal
Apache or nginx version (eg, Apache 2.4.25): nginx 1.18.0
PHP version (eg, 7.4): 7.4.3
Database: MariaDB 10.3.31

System installed from scratch (new SSD). Nextcloud runs flawlessly after installation. [Admin > Overview > Security & setup warnings => All checks passed.]
Intended to run only within the LAN. No access to outside world.
Backup from old installation available (Nextcloud but not yet restored.

1st attempt of user creation:

  1. Create new user with identical user name as old installation: “Users | New user”
  2. Chose identical password for this user as old installation
  3. Found out that due to the password policy old password is not valid (only the constraint that min. password length of 10 characters was infringed)
  4. Changed password policy in “Settings | Security | Password policy | Minimum password length”

2nd attempt of user creation:

  • User created as per step 1 & 2 from above
  • Newly created user was not able to login to Nextcloud
  • Login as Nextcloud admin and deleted new user

Issue I’m facing:

  • User that was created & deleted before cannot be created again. Error message box appears for half a second in upper right corner of Nextcloud web interface:
    An error occurred during the request. Unable to proceed. Username is invalid because files already exist for this user.

=> My hypothesis is that my iPhone synced via webdav in the meantime. I simply forgot to deactivate syncing. Indication: My iPhone calendar entries are gone & its address book is messed up.

BernieO’s tool calcardbackup was not able to backup any calendars/contacts because there is nothing from any user.


  1. Is there a way to get hold of the data (calendar/contacts) that was received from my iPhone?
  2. How can I prevent in future that a newly connected webdav client (e.g. phone/tablet) of a newly created Nextcloud user gets deleted (loses its calendar/contact entries)? => i.e. populate only from device to nc on first connect.
  3. How can I create this user? Restore from backup would be one option but is there another way?

Thanks a lot in advance.

The output of your Nextcloud log in Admin > Settings > Logging:

[ocs_api] Error: Failed addUser attempt with invalid argument exeption.

POST /ocs/v2.php/cloud/users
from by ncadmin at 2021-11-08T14:36:21+01:00
0. /var/www/nextcloud/lib/private/User/Manager.php - line 396:
1. /var/www/nextcloud/apps/provisioning_api/lib/Controller/UsersController.php - line 410:
2. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 217:
   OCA\Provisioning_API\Controller\UsersController->addUser("*** sensiti ... *")
3. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 126:
4. /var/www/nextcloud/lib/private/AppFramework/App.php - line 156:
5. /var/www/nextcloud/lib/private/Route/Router.php - line 301:
6. /var/www/nextcloud/ocs/v1.php - line 62:
7. /var/www/nextcloud/ocs/v2.php - line 23: