How can I Rectify Invalid Block Type Error in my custom module?

I created a custom module in Magento 2 for overriding the default product list page with a separate phtml file I am calling them in category update layout XML textarea. It's Working fine.

Now I don't want that so I deleted Layout Update XML textarea code and both my custom module block and phtml. After running setup upgrade and cleared var/all folders and pub/static/all folders . Still, I am getting Invalid Block Type error.

Do I need to delete anything from any tables?

  • you have to remove entire var folder Commented Oct 27, 2016 at 12:45
  • yes I removed all the folders inside var directory and all the folders inside pub/static folder Commented Oct 27, 2016 at 12:46
  • do you revert di.xml? if you do stuff in di.xml for override, please revert it to original state. Commented Oct 27, 2016 at 12:58
  • Have you disable that module before upgrade ? Commented Oct 27, 2016 at 13:06
  • I did not write any di.xml for it.I just call block and template in layout update xml file like this <referenceContainer name="content"> <referenceBlock name="category.products" remove="true"/> <block template="recipes/list.phtml" class="Embitel\CustomListPages\Block\Recipes" name="our_recipes"/> </referenceContainer> ---Bilal Usean Commented Oct 27, 2016 at 13:14

2 Answers 2


Enter the following at the command line to uninstall extension:

bin/magento module:disable vendor_module --clear-static-content

bin/magento setup:upgrade

rm -rf var/di

bin/magento setup:di:compile

bin/magento setup:static-content:deploy

Note : Clear the store cache, clear your browser cache, domain cookies, and refresh the page.

  • I followed all the steps in advanced tab module is not showing after completed these steps i removed that folder but No Luck.. :( Commented Oct 27, 2016 at 14:00
  • Try to restart apache and clear varnish cache Commented Oct 27, 2016 at 14:01
  • The Problem here is Only that category (for which category Update Layout Xml I wrote) showing this Error (Invalid Block type) again that category child categories are perfectly fine.Should we not write Update Layout Xml in category Edit (Admin side) page..? I think If we write Update Layout Xml for a category It is storing somewhere perminently thats y if I delete that Update Layout Xml mentioned block file it is showing error. Commented Oct 28, 2016 at 5:14

Actually I Entered Update Layout Xml snippet for Particular Category in Store View selected as "All Store Views" so I deleted The Update Layout xml Snippet from where I entered but Error was Not Gone.

The Solution For Above Question is That snippet is also there in currently Working store view So "Cleared my working Store View Update Layout Xml" snippet and saved the category. Refresh cache and Load page :)

Your Answer

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

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