After I moved a site from staging.site.nl to site.nl I received a weird error. If I try to reindex the site I get this error: No such entity.

If I try to login I get this message:

a:4:{i:0;s:15:"No such entity.";i:1;s:5964:"#0 /home/site/public_html/vendor/magento/module-store/Model/Store.php(542): Magento\Store\Model\WebsiteRepository->getById('0')

I copied all files, moved the database and did replace the URL values in core_config_data.

4 Answers 4


I had the same issue. It appeared to be caused by some Entity IDs that needed to be set to 0.

When you transfer the data the insert records on these specific records are automatically generated and tend to start at 1 and not 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.

  • Absolute life saver!!!!! Remember now having a similar issue in Magento 1 a few years back.
    – MagentoMac
    Commented Feb 17, 2017 at 16:28
  • 4
    Magento and it's ridiculous nuances are enough to drive anyone crazy! Thanks for this! Commented Feb 21, 2018 at 23:20
  • this code is not helping me,is there is any way that can track exactly what entity is missing?
    – akgola
    Commented Jul 27, 2018 at 10:35
  • Sorry @akgola, I have bee out of the Magento world now for a few years since this was answered, so not sure on that. Commented Jul 30, 2018 at 11:58
  • @AdamStacey, Its not working for me. even i used above solution Commented Nov 21, 2018 at 14:38

I changed database connection in env.php and the changed DB had everything like Adam's answer, but, due to wrong configuration in env.php, it could not connect to store_website table. I missed to write the table prefix there. After correcting, deploy and cache flush fixed that error.

  • Thanks. I helped me in my case. Commented Feb 14, 2021 at 18:47

This was caused by a bad export of my database. Everything seems to be fine, but after I did a dump via command line instead of Querious everything started to work fine.


I've fix that adding default set:

INSERT INTO `YOUR_DB`.`eav_attribute_set` (`attribute_set_id`, `entity_type_id`, `attribute_set_name`, `sort_order`) VALUES ('1', '1', 'Default', '1');
INSERT INTO `YOUR_DB`.`eav_attribute_set` (`attribute_set_id`, `entity_type_id`, `attribute_set_name`, `sort_order`) VALUES ('2', '2', 'Default', '1');
INSERT INTO `YOUR_DB`.`eav_attribute_set` (`attribute_set_id`, `entity_type_id`, `attribute_set_name`, `sort_order`) VALUES ('3', '3', 'Default', '1');
INSERT INTO `YOUR_DB`.`eav_attribute_set` (`attribute_set_id`, `entity_type_id`, `attribute_set_name`, `sort_order`) VALUES ('4', '4', 'Default', '1');
INSERT INTO `YOUR_DB`.`eav_attribute_set` (`attribute_set_id`, `entity_type_id`, `attribute_set_name`, `sort_order`) VALUES ('5', '5', 'Default', '1');
INSERT INTO `YOUR_DB`.`eav_attribute_set` (`attribute_set_id`, `entity_type_id`, `attribute_set_name`, `sort_order`) VALUES ('6', '6', 'Default', '1');
INSERT INTO `YOUR_DB`.`eav_attribute_set` (`attribute_set_id`, `entity_type_id`, `attribute_set_name`, `sort_order`) VALUES ('7', '7', 'Default', '1');
INSERT INTO `YOUR_DB`.`eav_attribute_set` (`attribute_set_id`, `entity_type_id`, `attribute_set_name`, `sort_order`) VALUES ('8', '8', 'Default', '1');

But now I should fix product name as it's missing.

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.