NC 24: one LDAP user cannot login anymore. "User folder for <username> exists as a file"

Nextcloud version (eg, 20.0.5): 24.0.8
Operating system and version (eg, Ubuntu 20.04): SLES 12 SP5
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.51
PHP version (eg, 7.4): 7.4.33

The issue you are facing:
Suddenly, an LDAP user can no longer log in. Hundreds of other users log in successfully.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

I cannot replicate it on test-server. Everything worked well since some years. There were no changes between last successful login and now. Except some OS-Updates, but theses Updates were also installed on test-server.

The output of your Nextcloud log in Admin > Logging:

2023-03-15T07:54:47.288289+01:00 servername nextcloud[29402]: {"reqId":"ZBFrt-BzcfTHm1R9hdU_uwAAAAM","level":3,"time":"2023-03-15T06:54:47+00:00","remoteAddr":"xx.xx.xx.xx","user":"username","app":"index","method":"GET","url":"/index.php/apps/files/","message":"{\"Exception\":\"Exception\",\"Message\":\"User folder for username exists as a file\",\"Code\":0,\"Trace\":[{\"function\":\"getUserFolder\",\"class\":\"OC\\\\Files\\\\Node\\\\Root\",\"type\":\"->\"},{\"file\":\"/srv/www/htdocs/nextcloud/lib/private/Files/Node/LazyFolder.php\",\"line\":72,\"function\":\"call_user_func_array\"},{\"file\":\"/srv/www/htdocs/nextcloud/lib/private/Files/Node/LazyRoot.php\",\"line\":40,\"function\":\"__call\",\"class\":\"OC\\\\Files\\\\Node\\\\LazyFolder\",\"type\":\"->\"},{\"file\":\"/srv/www/htdocs/nextcloud/lib/private/Server.php\",\"line\":1660,\"function\":\"getUserFolder\",\"class\":\"OC\\\\Files\\\\Node\\\\LazyRoot\",\"type\":\"->\"},{\"file\":\"/srv/www/htdocs/nextcloud/apps/files/lib/Activity/Helper.php\",\"line\":60,\"function\":\"getUserFolder\",\"class\":\"OC\\\\Server\",\"type\":\"->\"},{\"file\":\"/srv/www/htdocs/nextcloud/apps/files/lib/Controller/ViewController.php\",\"line\":210,\"function\":\"getFavoriteFilePaths\",\"class\":\"OCA\\\\Files\\\\Activity\\\\Helper\",\"type\":\"->\"},{\"file\":\"/srv/www/htdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":225,\"function\":\"index\",\"class\":\"OCA\\\\Files\\\\Controller\\\\ViewController\",\"type\":\"->\"},{\"file\":\"/srv/www/htdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":133,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"/srv/www/htdocs/nextcloud/lib/private/AppFramework/App.php\",\"line\":172,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"/srv/www/htdocs/nextcloud/lib/private/Route/Router.php\",\"line\":298,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\"},{\"file\":\"/srv/www/htdocs/nextcloud/lib/base.php\",\"line\":1030,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\"},{\"file\":\"/srv/www/htdocs/nextcloud/index.php\",\"line\":36,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\"}],\"File\":\"/srv/www/htdocs/nextcloud/lib/private/Files/Node/Root.php\",\"Line\":389,\"CustomMessage\":\"--\"}","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0","version":"24.0.8.2"}

“User folder for <username> exists as a file”

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'dbtype' => 'mysql',
  'version' => '24.0.8.2',
  'logtimezone' => 'UTC',
  'installed' => true,
  'enable_previews' => false,
  'default_language' => 'de',
  'loglevel' => 1,
  'log_type' => 'syslog',
  'syslog_tag' => 'nextcloud',
  'updater.release.channel' => 'stable',
  'maintenance' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => 'noreply',
  'trashbin_retention_obligation' => '14,28',
  'auth.bruteforce.protection.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\Memcached',
  'memcache.distributed' => '\\OC\\Memcache\\Memcached',
  'memcached_servers' =>
  array (
    0 =>
    array (
      0 => 'localhost',
      1 => 11211,
    ),
  ),
  'mysql.utf8mb4' => true,
  'app_install_overwrite' =>
  array (
    0 => 'calendar',
  ),
  'remember_login_cookie_lifetime' => 0,
  'session_lifetime' => 28800,
  'mail_sendmailmode' => 'smtp',
  'simpleSignUpLink.shown' => false,
  'activity_use_cached_mountpoints' => 'true',
  'auth.webauthn.enabled' => false,
  'defaultapp' => 'files',
  'profile.enabled' => false,
};

The output of your Apache/nginx/system log in /var/log/____:

xx.xx.xx.xx - - [15/Mar/2023:07:54:47 +0100] "GET /index.php/apps/files/ HTTP/1.1" 500 5186 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64;rv:109.0) Gecko/20100101 Firefox/110.0"
xx.xx.xx.xx - - [15/Mar/2023:07:54:47 +0100] "GET /dist/core-common.js?v=773e14d3-15 HTTP/1.1" 200 9474337 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0"

Restarting the service and restarting the server did not help.

I am grateful for any advice.

User folder for username exists as a file

In your data folder, perhaps instead of a directory for the user, there is perhaps just a file of the same name

Thank you very much for your advice. I have already checked this. The directory still exists and is ok. There is no file with the same name at this location.

It seems to be related to group memberships. If I remove the user from a particular one of his many groups, everything works again.

I have not been able to figure out the actual reason though. But I am investigating this further.

Reason for this error:

Using app “deck”, share a deck with other user, have a card with attachment which has a very looooooong file name. Storage of this file and using the deck/card works fine for the owner.

But other users with whom the card was shared will get an error. The problem is that deck wants to map a “deck” folder to the other users startpage. This does not work with very loooooong filenames. So it is a bug from app “deck”.

Solution: remove attachment from card. add file with a short/usual name to the card.