So when I run the php bin/magento cron:run I get error as PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Filesystem\DriverInterface

This error gets disappear after two times I run the cron:run In my local Magento 2.3.4 setup. But unfortunately in Cloud Instance this error persist forever. So looking for the solution.

The below code in my custom module cron.php file which is scheduled as * * * * *

public function __construct(
    \Magento\Framework\Filesystem\DriverInterface $driverInterface,
) {
        $this->_fileDriverInterface = $fileDriverInterface;

I have found in local If I run php bin/magent setup:upgrade I get this error for two time while running cron:run as mentioned above. After that it works.

Anyone has idea about this error?

1 Answer 1


You should run this below command:

rm -rf generated
rm -rf var/*
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento setup:di:compile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.