OCC DB Missing indices giving error

php occ db:add-missing-indices
Content-type: text/html; charset=UTF-8

An unhandled exception has been thrown:
TypeError: Return value of OC\AppFramework\Http\Request::getScriptName() must be of the type string, null returned in /home/nextcloud/public_html/lib/private/AppFramework/Http/Request.php:824
Stack trace:
#0 /home/nextcloud/public_html/lib/base.php(164): OC\AppFramework\Http\Request->getScriptName()
#1 /home/nextcloud/public_html/lib/base.php(575): OC::initPaths()
#2 /home/nextcloud/public_html/lib/base.php(1087): OC::init()
#3 /home/nextcloud/public_html/console.php(48): require_once(’/home/nextcloud…’)
#4 /home/nextcloud/public_html/occ(11): require_once(’/home/nextcloud…’)

Nextcloud - 23.0.0
PHP 7.4
mysql 8

Please guide me on this as I’m not able to fix this