Getting status 500 on ncp-launcher.php when trying to load admin console

Nextcloud version: 27.0.1.2
Nextcloudpi version: 1.52.4
Operating system and version: Debian GNU/Linux 11 (bullseye)
Apache or nginx version: Apache/2.4.56 (Debian)
PHP version: PHP 8.1.22 (cli) (built: Aug 29 2023 10:48:28)

The issue you are facing:

When trying to access the admin panel; i.e. the interface delivered on port 4443, the page fails to load, and javascript console shows:

[Error] Failed to load resource: the server responded with a status of 500 () (ncp-launcher.php, line 0)
This prevents accessing functionality such as nc-upgrade, nc-backup, etc.

Is this the first time you’ve seen this error?: N
Access to the admin console has worked fine for years. This error seemed to start with a recent upgrade / update

Steps to replicate it:

  1. Point the browser to 192.168.1.20:4443
  2. Bypass the certificate errors as needed

The output of your Nextcloud log in Admin > Logging:

[files] Warning: User admin still has unscanned files after running background scan, background scan might be stopped prematurely

at 2023-09-13T11:35:02+00:00

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

<?php
$CONFIG = array (
  'passwordsalt' => redacted,
  'secret' => redacted,
  'trusted_domains' => 
  array (
    0 => 'localhost',
    5 => 'nextcloudpi.local',
    1 => '192.168.1.20',
    3 => 'nextcloudpi',
    4 => 'redacted].ddns.net',
    7 => 'nextcloudpi',
    8 => 'nextcloudpi.lan',
    11 => '2600:4041:79c3:a000:1d14:4916:5969:89e3',
    12 => redacted,
    22 => redacted,
    14 => 'nextcloudpi',
    25 => redacted,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
	  array (
	    'host' => '/var/run/redis/redis.sock',
	    'port' => 0,
	    'password' => redacted,
	  ),
	  'datadirectory' => '/media/nextCloudDrive/ncdata',
	  'overwrite.cli.url' => 'https://nextcloudpi/',
	  'dbtype' => 'mysql',
	  'default_phone_region' => 'US',
	  'version' => '27.0.1.2',
	  'dbname' => 'nextcloud',
	  'dbhost' => 'localhost',
	  'dbport' => '',
	  'dbtableprefix' => 'oc_',
	  'mysql.utf8mb4' => true,
	  'dbuser' => 'ncadmin',
	  'dbpassword' => redacted,
	  'installed' => true,
	  'instanceid' => 'ocblr2m190u4',
	  'mail_smtpmode' => 'smtp',
	  'mail_smtpauthtype' => 'LOGIN',
	  'mail_from_address' => redacted,
	  'mail_domain' => redacted,
	  'overwriteprotocol' => 'https',
	  'maintenance' => false,
	  'theme' => '',
	  'loglevel' => 2,
	  'jpeg_quality' => '60',
	  'mail_sendmailmode' => 'smtp',
	  'mail_smtpauth' => 1,
	  'mail_smtphost' => redacted,
	  'mail_smtpsecure' => 'ssl',
	  'mail_smtpport' => '465',
	  'mail_smtpname' => redacted,
	  'mail_smtppassword' => redacted,
	  'data-fingerprint' => redacted,
	  'trusted_proxies' => 
	  array (
	    11 => '127.0.0.1',
	    12 => '::1',
	    13 => 'nextcloudpi',
	    14 => '192.168.1.20',
	  ),
	  'tempdirectory' => '/media/nextCloudDrive/ncdata/tmp',
	  'logfile' => '/media/nextCloudDrive/ncdata/nextcloud.log',
	  'htaccess.RewriteBase' => '/',
	);

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

[Wed Sep 13 00:00:04.337433 2023] [ssl:warn] [pid 1723:tid 548193133632] AH01909
: localhost:4443:0 server certificate does NOT include an ID which matches the s
erver name
[Wed Sep 13 00:00:04.340121 2023] [mpm_event:notice] [pid 1723:tid 548193133632]
 AH00489: Apache/2.4.56 (Debian) OpenSSL/1.1.1n configured -- resuming normal op
erations
[Wed Sep 13 00:00:04.340160 2023] [core:notice] [pid 1723:tid 548193133632] AH00
094: Command line: '/usr/sbin/apache2'
[Wed Sep 13 10:42:47.145834 2023] [proxy_fcgi:error] [pid 1278118:tid 5480995188
48] [remote 192.168.1.155:51999] AH01071: Got error 'PHP message: PHP Fatal erro
r:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type
 array, null given in /var/www/ncp-web/backups.php:76\nStack trace:\n#0 /var/www
/ncp-web/ncp-launcher.php(146): include()\n#1 {main}\n  thrown in /var/www/ncp-w
eb/backups.php on line 76'
[Wed Sep 13 10:43:15.407510 2023] [proxy_fcgi:error] [pid 1278118:tid 5480658824
96] [remote 192.168.1.155:51999] AH01071: Got error 'PHP message: PHP Fatal erro
r:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type
 array, null given in /var/www/ncp-web/backups.php:76\nStack trace:\n#0 /var/www
/ncp-web/ncp-launcher.php(146): include()\n#1 {main}\n  thrown in /var/www/ncp-w
eb/backups.php on line 76'
[Wed Sep 13 10:49:25.122066 2023] [proxy_fcgi:error] [pid 1278118:tid 5479986097
92] [remote 192.168.1.155:51999] AH01071: Got error 'PHP message: PHP Fatal erro
r:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type
 array, null given in /var/www/ncp-web/backups.php:76\nStack trace:\n#0 /var/www
/ncp-web/ncp-launcher.php(146): include()\n#1 {main}\n  thrown in /var/www/ncp-w
eb/backups.php on line 76'
[Wed Sep 13 10:54:42.826320 2023] [proxy_fcgi:error] [pid 1278118:tid 5480406552
32] [remote 192.168.1.155:51999] AH01067: Failed to read FastCGI header
[Wed Sep 13 10:54:42.826485 2023] [proxy_fcgi:error] [pid 1278118:tid 5480406552
32] (104)Connection reset by peer: [remote 192.168.1.155:51999] AH01075: Error d
ispatching request to :4443: 
[Wed Sep 13 10:55:08.315451 2023] [mpm_event:notice] [pid 1723:tid 548193133632]
 AH00492: caught SIGWINCH, shutting down gracefully
[Wed Sep 13 10:55:11.691635 2023] [core:warn] [pid 1723:tid 548193133632] AH0004
5: child process 1278118 still did not exit, sending a SIGTERM
[Wed Sep 13 10:55:13.693894 2023] [core:warn] [pid 1723:tid 548193133632] AH0004
5: child process 1278118 still did not exit, sending a SIGTERM
[Wed Sep 13 10:55:15.696171 2023] [core:warn] [pid 1723:tid 548193133632] AH0004
5: child process 1278118 still did not exit, sending a SIGTERM
[Wed Sep 13 10:55:17.698176 2023] [core:error] [pid 1723:tid 548193133632] AH000
46: child process 1278118 still did not exit, sending a SIGKILL
[Wed Sep 13 10:56:14.063806 2023] [ssl:warn] [pid 1774:tid 547681350720] AH01909
: localhost:4443:0 server certificate does NOT include an ID which matches the s
erver name
[Wed Sep 13 10:56:14.138585 2023] [ssl:warn] [pid 1787:tid 547681350720] AH01909
: localhost:4443:0 server certificate does NOT include an ID which matches the s
erver name
[Wed Sep 13 10:56:14.151746 2023] [mpm_event:notice] [pid 1787:tid 547681350720]
 AH00489: Apache/2.4.56 (Debian) OpenSSL/1.1.1n configured -- resuming normal op
erations
[Wed Sep 13 10:56:14.151937 2023] [core:notice] [pid 1787:tid 547681350720] AH00
094: Command line: '/usr/sbin/apache2'
[Wed Sep 13 10:56:43.828458 2023] [proxy_fcgi:error] [pid 1789:tid 547663344000]
 [remote 192.168.1.155:52325] AH01071: Got error 'PHP message: PHP Fatal error: 
 Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type ar
ray, null given in /var/www/ncp-web/backups.php:76\nStack trace:\n#0 /var/www/nc
p-web/ncp-launcher.php(146): include()\n#1 {main}\n  thrown in /var/www/ncp-web/
backups.php on line 76'
[Wed Sep 13 11:10:23.145516 2023] [authz_host:error] [pid 1788:tid 547520471424]
 [remote 70.18.8.215:52543] AH01753: access check of 'localhost' to / failed, re
ason: unable to get the remote host name
[Wed Sep 13 11:10:23.145686 2023] [authz_core:error] [pid 1788:tid 547520471424]
 [remote 70.18.8.215:52543] AH01630: client denied by server configuration: /var
/www/ncp-web/
[Wed Sep 13 11:10:23.232410 2023] [authz_host:error] [pid 1788:tid 547512062336]
 [remote 70.18.8.215:52543] AH01753: access check of 'localhost' to /favicon.ico
 failed, reason: unable to get the remote host name, referer: https://hallorancl
oud.ddns.net:4443/
[Wed Sep 13 11:10:23.232509 2023] [authz_core:error] [pid 1788:tid 547512062336]
 [remote 70.18.8.215:52543] AH01630: client denied by server configuration: /var
/www/ncp-web/favicon.ico, referer: https://hallorancloud.ddns.net:4443/
[Wed Sep 13 11:10:29.032344 2023] [authz_host:error] [pid 1788:tid 547503653248]
 [remote 70.18.8.215:52544] AH01753: access check of 'localhost' to / failed, re
ason: unable to get the remote host name
[Wed Sep 13 11:10:29.032509 2023] [authz_core:error] [pid 1788:tid 547503653248]
 [remote 70.18.8.215:52544] AH01630: client denied by server configuration: /var
/www/ncp-web/
[Wed Sep 13 11:10:42.337686 2023] [authz_host:error] [pid 1788:tid 547486835072]
 [remote 70.18.8.215:52546] AH01753: access check of 'localhost' to / failed, re
ason: unable to get the remote host name
[Wed Sep 13 11:10:42.337780 2023] [authz_core:error] [pid 1788:tid 547486835072]
 [remote 70.18.8.215:52546] AH01630: client denied by server configuration: /var
/www/ncp-web/
[Wed Sep 13 11:15:21.726211 2023] [proxy_fcgi:error] [pid 1789:tid 547486835072]
 [remote 192.168.1.155:52678] AH01071: Got error 'PHP message: PHP Fatal error: 
 Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type ar
ray, null given in /var/www/ncp-web/backups.php:76\nStack trace:\n#0 /var/www/nc
p-web/ncp-launcher.php(146): include()\n#1 {main}\n  thrown in /var/www/ncp-web/
backups.php on line 76'
[Wed Sep 13 11:15:42.493286 2023] [proxy_fcgi:error] [pid 1789:tid 547612971392]
 [remote 192.168.1.155:52678] AH01071: Got error 'PHP message: PHP Fatal error: 
 Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type ar
ray, null given in /var/www/ncp-web/backups.php:76\nStack trace:\n#0 /var/www/nc
p-web/ncp-launcher.php(146): include()\n#1 {main}\n  thrown in /var/www/ncp-web/
backups.php on line 76'
[Wed Sep 13 11:20:47.559229 2023] [proxy_fcgi:error] [pid 1789:tid 545905426816]
 [remote 192.168.1.155:52678] AH01067: Failed to read FastCGI header
[Wed Sep 13 11:20:47.559340 2023] [proxy_fcgi:error] [pid 1789:tid 545905426816]
 (104)Connection reset by peer: [remote 192.168.1.155:52678] AH01075: Error disp
atching request to :4443: 
[Wed Sep 13 11:20:47.642416 2023] [mpm_event:notice] [pid 1787:tid 547681350720]
 AH00492: caught SIGWINCH, shutting down gracefully
[Wed Sep 13 11:21:43.550723 2023] [ssl:warn] [pid 1771:tid 548182369344] AH01909
: localhost:4443:0 server certificate does NOT include an ID which matches the s
erver name
[Wed Sep 13 11:21:43.646383 2023] [ssl:warn] [pid 1784:tid 548182369344] AH01909
: localhost:4443:0 server certificate does NOT include an ID which matches the s
erver name
[Wed Sep 13 11:21:43.659864 2023] [mpm_event:notice] [pid 1784:tid 548182369344]
 AH00489: Apache/2.4.56 (Debian) OpenSSL/1.1.1n configured -- resuming normal op
erations
[Wed Sep 13 11:21:43.660069 2023] [core:notice] [pid 1784:tid 548182369344] AH00
094: Command line: '/usr/sbin/apache2'
[Wed Sep 13 11:22:15.382585 2023] [proxy_fcgi:error] [pid 1786:tid 548013080960]
 [remote 192.168.1.155:52790] AH01071: Got error 'PHP message: PHP Fatal error: 
 Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type ar
ray, null given in /var/www/ncp-web/backups.php:76\nStack trace:\n#0 /var/www/nc
p-web/ncp-launcher.php(146): include()\n#1 {main}\n  thrown in /var/www/ncp-web/
backups.php on line 76'
[Wed Sep 13 11:26:08.952921 2023] [mpm_event:notice] [pid 1784:tid 548182369344]
 AH00492: caught SIGWINCH, shutting down gracefully
[Wed Sep 13 11:26:08.985157 2023] [proxy_fcgi:error] [pid 1786:tid 548021490048]
 [remote 192.168.1.155:52790] AH01067: Failed to read FastCGI header
[Wed Sep 13 11:26:08.985645 2023] [proxy_fcgi:error] [pid 1786:tid 548021490048]
 (104)Connection reset by peer: [remote 192.168.1.155:52790] AH01075: Error disp
atching request to :4443: 
[Wed Sep 13 11:26:12.327238 2023] [core:warn] [pid 1784:tid 548182369344] AH0004
5: child process 1786 still did not exit, sending a SIGTERM
[Wed Sep 13 11:26:14.329399 2023] [core:warn] [pid 1784:tid 548182369344] AH0004
5: child process 1786 still did not exit, sending a SIGTERM
[Wed Sep 13 11:26:16.331662 2023] [core:warn] [pid 1784:tid 548182369344] AH0004
5: child process 1786 still did not exit, sending a SIGTERM
[Wed Sep 13 11:26:18.333913 2023] [core:error] [pid 1784:tid 548182369344] AH000
46: child process 1786 still did not exit, sending a SIGKILL
[Wed Sep 13 11:27:13.476821 2023] [ssl:warn] [pid 1785:tid 548608689216] AH01909
: localhost:4443:0 server certificate does NOT include an ID which matches the s
erver name
[Wed Sep 13 11:27:13.574496 2023] [ssl:warn] [pid 1798:tid 548608689216] AH01909
: localhost:4443:0 server certificate does NOT include an ID which matches the s
erver name
[Wed Sep 13 11:27:13.587893 2023] [mpm_event:notice] [pid 1798:tid 548608689216]
 AH00489: Apache/2.4.56 (Debian) OpenSSL/1.1.1n configured -- resuming normal op
erations
[Wed Sep 13 11:27:13.588130 2023] [core:notice] [pid 1798:tid 548608689216] AH00
094: Command line: '/usr/sbin/apache2'
[Wed Sep 13 11:45:55.416684 2023] [proxy_fcgi:error] [pid 1799:tid 548557111680]
 [remote 192.168.1.155:52860] AH01071: Got error 'PHP message: PHP Fatal error: 
 Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type ar
ray, null given in /var/www/ncp-web/backups.php:76\nStack trace:\n#0 /var/www/nc
p-web/ncp-launcher.php(146): include()\n#1 {main}\n  thrown in /var/www/ncp-web/
backups.php on line 76'

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.

FWIW - I’ve resolved this issue by removing the file:
/var/www/ncp-web/backup-info-cache.cfg
which was apparently corrupted: i.e.:
# hexdump /var/www/ncp-web/backup-info-cache.old
0000000 756e 6c6c
0000004

The corrupted file was not getting to an empty array at line 76.

As I’m not a php dev, I do not know what is the right solution here, nor do I know how the backup-info-cache.cfg file gets generated, so I’m reluctant to open a pull request.