I have successfully migrated the catalog from Magento to Magento 2.0.2. After the migration, I did reindex using the command php bin/magento indexer:reindex.

All is reindexed successfully, except indexes catalog_category_product and catalog_product_category, returning No such entity. in shell and notification Reindex Required in admin. I've checked var/log/ but no errors.

As a result, products are added to categories in the backend but categories show up empty on the frontend.

What might cause this problem? How can I debug?


6 Answers 6


In addition to Raphael:

I Debugged this code with altering the exception constructor for debug purposes (either by xdebug or old dumps). Alter the construct of the exception for now (the file is \lib\internal\Magento\Framework\Exception\NoSuchEntityException.php)

$trace = debug_backtrace();
var_dump($trace[1]['class'] . '::' . $trace[1]['function'] . '('.$trace[1]['line'] .')';

After that go up one stack and check the arguments given (the args are also available in the debug backtrace, but dumping magento objects isn't really browser friendly).

Came to the conclusion, that it was in the storeGroupRepository where it couldn't find the group id. Dived into the store tables and saw a few lines in the store table that were referencing a store_group that wasn't in the store_group table(store group not exist in relevant table).

Removed the faulty store lines and the error has been gone ever since.

But, keep in mind that it can also be in a different table/other reason. for example website, store itself or store group in this case. So that is always a little search you have to perform yourself.

Also found out that there were quite a lot of references to these stores and also removed them manually in the db. This can be a tedious work but it will solve the problem.

And don't forget to remove your hacks.


Not sure if this is too late to add, but when I had this It appeared to be caused by some entity ids that needed to be set to 0.

This script worked for me:

UPDATE `store` SET store_id = 0 WHERE code='admin';
UPDATE `store_group` SET group_id = 0 WHERE name='Default';
UPDATE `store_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';

Hope it helps.

  • this helped me a lot, thank you for sharing!
    – favo
    May 17, 2017 at 14:10
  • This also worked for me :)
    – owenmelbz
    Jan 27, 2018 at 9:18

Ok so the No such entity. error message comes from \lib\internal\Magento\Framework\Exception\NoSuchEntityException.php.

This class is a custom exception class of Magento and it is used a lot in Magento 2.

Whenever you see code like:

catch (NoSuchEntityException $e)


throw NoSuchEntityException;

This class is being used.

The problem in your case is that it's hard to find out from where that exception is being thrown.

So to narrow it a bit, you can start debugging the two classes related to your indexes that fail:

  • Magento\Catalog\Model\Indexer\Category\Product => catalog_category_product index
  • Magento\Catalog\Model\Indexer\Product\Category => catalog_product_category index

Fortunately, the second one extends the first one so you've got one starting point.

You've got to keep in mind that each of this indexer class uses action rows classes to process the reindexing:

  • Magento\Catalog\Model\Indexer\Product\Category\Action\Rows
  • Magento\Catalog\Model\Indexer\Category\Product\Action\Rows

To me that's where you should start debugging as those action row classes are the direct classes which are reindexing those two indexes.

I really hope it will help you find your problem.



Assuming your site is in Developer Mode, you can change it to Production Mode and clear/flush cache and then switch back to Developer Mode.

I had this issue in the front end, as i recently moved the database from one server to another. I have managed to solve by this way.



Basically the same

Magento 2 - Moving site - 'No such entity'

cd /magento-root-path/var

rm -rf *

cd ../

php bin/magento setup:upgrade

rm -rf ./var/di

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy

chown -R www-data .


This error, in my case, was for a multi-store, multi-domain setup. Magento truncates store codes. If you're mapping domains to store codes go make sure the store code matches the routing specified in index.php ( or wherever you map ). In the admin check under "Stores" > "All Stores." Check your website, store & store view store codes.

Once I realized Magento truncated the store code I'd entered and made the same adjustment in mapping & everything started working again.

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.