cancel
Showing results for 
Search instead for 
Did you mean: 

No such entity with id = 3

SOLVED
Highlighted

Re: No such entity with id = 3

Thanks! Works for me

Highlighted

Re: No such entity with id = 3

this is not right solution.

 

right solution is , take category that you are editing and go to catalog_category_entity table and check parent id of it. 

if you are editing category id, 1120

and its parent id is 3

and path is 1/2/13/1112/1120

 

that means, you may have messed up category structure in entity table. parent id is not available in magento database. so you need to change parent id of that category to 1112.

ex: category is 1120

parent id is 1112

and path is 1/2/13/1112 (parent id) /1120

 

so this will resolve issue.

Highlighted

Re: No such entity with id = 3

Can remove orphaned url rewrite records.

 

DELETE FROM url_rewrite WHERE entity_type = 'category' AND entity_id NOT IN (SELECT entity_id FROM catalog_category_entity)


This problem happens (or at least happened for me) when catalog_category_entity records were deleted with SQL query. (We had duplicated categories with same name somehow...) 

 

 

There may also be url_rewrite for the product entitys with a metadata category_id of this id.
For example mine was 1471
{"category_id":"1471"}

 

SELECT * FROM url_rewrite WHERE metadata LIKE '%"category_id":"1471"%'

I could remove these with
DELETE FROM url_rewrite WHERE metadata LIKE '%"category_id":"1471"%'


Which resolved the issue in my case.
But I'm not sure the best way to correct these, maybe truncating or deleting the records from the url_rewrite and having it regenerate somehow? any thoughts?

Highlighted

Re: No such entity with id = 3

I face the isse with No such entity with id = 0 
then i comment lines above you have mention then it give me new error

Exception #0 (Magento\Framework\Exception\StateException): The bucket doesn't exist.