I am getting the following error message:

main.CRITICAL: Type Error occurred when creating object: Vendor\CartUpdate\Plugin\Minicart\Image, Argument 1 passed to Vendor\CartUpdate\Plugin\Minicart\Image::__construct() must be an instance of Vendor\CartUpdate\Model\DynamicImage, instance of Vendor\CartInitial\Model\DynamicImage given, called in /home/coriolan/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121 [] []

Indeed, Vendor/CartInitial was the initial module that was used, but I've changed it to Vendor/CartUpdate in the past few days. However, there is strange behavior related to it. When I run the CLI commands and use rm -rf generated/* it works, but after a few hours, it does not work anymore and I get the same error again.

What can I do to avoid this problem?

1 Answer 1


When you change the constructor of a file you should run a bin/magento setup:upgrade to avoid this kind of error.

  • I did it and I usually do this all the time. However, it seems to be fixed. It seemed to be something related to caching. I'm using LiteSpeed Web Server with its strong caching mechanism. Thank you!
    – iupaem
    Jan 22 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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