Nextcloud error 500 on 8.1 yesterday, works on 7.4

Nextcloud version: 24.0.8
Operating system and version _Debian 11/ARM64
Apache/2.4.54 (Debian)
PHP version: 8.1.13 & 8.1.14

The issue you are facing:
Nextcloud stopped working with internal server error under PHP 8.1 yesterday but works when downgraded to 7.4. No knowing changes to server. Other apps continue working under 8.1. Nextcloud has worked fine on 8.1 since upgrading 5 months ago.

Is this the first time you’ve seen this error? Yes

Steps to replicate it:

  1. Rebooted server
  2. Downgrade to 7.4 & re-upgrade to 8.1
  3. Upgraded 8.1.13 to 8.1.14

The output of your Nextcloud log in Admin > Logging:
[Nothing logged for relevant period]

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

<?php
$CONFIG = array (
  'instanceid' => 'xxxx',
  'passwordsalt' => 'xxxx',
  'secret' => 'xxxx',
  'trusted_domains' => 
  array (
    0 => 'xxxx.com',
    1 => 'xxxs.com',
  ),
  'datadirectory' => '/var/www/clients/client1/web9/web/nextcloud/data',
  'overwrite.cli.url' => 'https://xxxx.com',
  'dbtype' => 'mysql',
  'version' => '24.0.8.2',
  'dbname' => 'c1_xxxx_nc1',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'c1_xxxx',
  'dbpassword' => 'xxxx',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'trashbin_retention_obligation' => 'auto, 30',
  'mail_from_address' => 'admin',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => 'xxxx.co.uk',
  'updater.release.channel' => 'stable',
  'mail_smtphost' => 'mail.xxxx.com',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'xxxx@xxxxs.com',
  'mail_smtppassword' => 'xxxx',
  'mail_smtpport' => '25',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'default_phone_region' => ' gb',
  'mysql.utf8mb4' => true,
  'app_install_overwrite' => 
  array (
    0 => 'bruteforcesettings',
  ),
);

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

[Just before & after suspected incident]

xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:fe08:9c03 - - [11/Jan/2023:15:37:43 +0000] "PROPFIND /remote.php/dav/files/xxxx/ HTTP/1.1" 207 1164 "-" "Mozilla/5.0 (Linux) mirall/3.1.1-2+deb11u1 (Nextcloud)"
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:fe40:9c16 - - [11/Jan/2023:15:37:47 +0000] "PROPFIND /remote.php/dav/files/xxxx/ HTTP/1.1" 207 6912 "-" "Mozilla/5.0 (Linux) mirall/2.5.1"
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:fe40:9c16 - - [11/Jan/2023:15:37:57 +0000] "PROPFIND /remote.php/dav/files/xxxx/ HTTP/1.1" 207 6901 "-" "Mozilla/5.0 (Linux) mirall/2.5.1"
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:fe08:9c03 - - [11/Jan/2023:15:38:10 +0000] "PROPFIND /remote.php/dav/files/xxxx/ HTTP/1.1" 500 6473 "-" "Mozilla/5.0 (Linux) mirall/3.1.1-2+deb11u1 (Nextcloud)"
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:fe40:9c16 - - [11/Jan/2023:15:38:19 +0000] "PROPFIND /remote.php/dav/files/xxxx/ HTTP/1.1" 500 6488 "-" "Mozilla/5.0 (Linux) mirall/2.5.1"
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:fe08:9c03 - - [11/Jan/2023:15:38:42 +0000] "GET /status.php HTTP/1.1" 500 6162 "-" "Mozilla/5.0 (Linux) mirall/3.1.1-2+deb11u1 (Nextcloud)"
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:fe40:9c16 - - [11/Jan/2023:15:38:51 +0000] "GET /status.php HTTP/1.1" 500 6177 "-" "Mozilla/5.0 (Linux) mirall/2.5.1"
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:fe08:9c03 - - [11/Jan/2023:15:39:14 +0000] "GET /status.php HTTP/1.1" 500 6162 "-" "Mozilla/5.0 (Linux) mirall/3.1.1-2+deb11u1 (Nextcloud)"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
[Nothing logged for relevant period]

Did you find out the solution for this? I have had a similar issue like yours.