Internal Server Error for new user group user

Nextcloud version (eg, 20.0.5): 25.0.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.05
Apache or nginx version (eg, Apache 2.4.25): 2.4.41
PHP version (eg, 7.4): 7.4.3

The issue you are facing:
Newly created group user sees server error after login

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

Steps to replicate it:

  1. As an administrator, I create a new group
  2. I add a new user to the group, assigning email and password
  3. The user logs in with the credentials (2)
  4. The user is prompted to set up OTP
  5. After setting up OTP and entering the token, login fails with an internal server error

The output of your Nextcloud log in Admin > Logging:

https://pastebin.com/raw/ENyJpTpW

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

<?php
$CONFIG = array (
  'instanceid' => 'redacted',
  'passwordsalt' => 'redacted',
  'secret' => 'redacted',
  'trusted_domains' =>
  array (
    0 => 'redacted',
  ),
  'datadirectory' => '/ncdata',
  'dbtype' => 'mysql',
  'version' => '25.0.0.18',
  'overwrite.cli.url' => 'redacted',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'redacted',
  'installed' => true,
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
  ),
  'trusted_proxies' =>
  array (
    0 => '127.0.0.1',
    1 => '::1',
    2 => 'redacted',
  ),
  'skeletondirectory' => '',
  'maintenance' => false,
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'redacted',
  'mail_smtphost' => 'redacted',
  'mail_from_address' => 'no-reply',
  'mail_smtpport' => '587',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'redacted',
  'mail_smtppassword' => 'redacted',
  'log_rotate_size' => 10000000,
  'theme' => '',
  'loglevel' => 0,
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
    0 => 'no2FA',
  ),
  'updater.release.channel' => 'stable',
  'app_install_overwrite' =>
  array (
    0 => 'richdocuments',
    1 => 'impersonate',
    2 => 'fulltextsearch',
    3 => 'fulltextsearch_elasticsearch',
    4 => 'files_fulltextsearch',
  ),
);