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.


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.

| improve this answer | |
  • Absolute life saver!!!!! Remember now having a similar issue in Magento 1 a few years back. – MagentoMac Feb 17 '17 at 16:28
  • 3
    Magento and it's ridiculous nuances are enough to drive anyone crazy! Thanks for this! – domdambrogia Feb 21 '18 at 23:20
  • this code is not helping me,is there is any way that can track exactly what entity is missing? – akgola Jul 27 '18 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. – Adam Stacey Jul 30 '18 at 11:58
  • @AdamStacey, Its not working for me. even i used above solution – jafar pinjar Nov 21 '18 at 14:38

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.

| improve this answer | |

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.

| improve this answer | |

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.