Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

An exception was raised while creating “Request”; no instance returned – Magento 2

Ran into this issue on a client’s cPanel hosting account while maintaining their Magento site:

An exception was raised while creating "Request"; no instance returned

The server returned this error when trying to run maintenance commands via the terminal like the one below:

php bin/magento indexer:reindex

A little investigation revealed different versions of PHP running on the webserver and terminal. The terminal had been upgraded to 7.3 which the installed version of Magento does not support.

There are a couple of ways to fix this, but we’ll look at the simplest / easiest way to go about it.

If you can, navigate into /usr/bin and list to see which versions of PHP are available otherwise try guessing:

Try issuing the command as:

php71 bin/magento indexer:reindex

This worked for us.