Data-migration-tool: Attempt to load value of nonexistent EAV attribute

Created on 5 Oct 2018  ·  41Comments  ·  Source: magento/data-migration-tool

Preconditions

  1. Magento 1 EE 1.14.3.10
  2. Magento 2 EE 2.2.6
  3. PHP 7.1.22
  4. MySQL 5.7.23

Steps to reproduce

  1. Migrate data from Magento 1 to 2
  2. View a product page

Expected result

  1. No error. This error started to occur in Magento EE 2.2.6.

Actual result

  1. Errors in system.log and support_report.log
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '83' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '169' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '501' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '167' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '215' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '220' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '223' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '395' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '402' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '417' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '451' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '452' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:52] report.WARNING: Attempt to load value of nonexistent EAV attribute '551' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '83' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '438' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '167' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '215' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '220' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '221' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '222' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '223' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '269' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '332' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '395' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '402' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '417' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '451' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '452' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-10-05 12:40:53] report.WARNING: Attempt to load value of nonexistent EAV attribute '470' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
  1. But these attributes do in fact exist, for example eav_attribute 83
SELECT attribute_id, entity_type_id, attribute_code, attribute_model, backend_model, backend_type, backend_table, frontend_model, frontend_input, frontend_label, frontend_class, source_model, is_required, is_user_defined, default_value, is_unique, note
FROM magento2_prod.eav_attribute
WHERE attribute_id=83;```

attribute_id entity_type_id attribute_code attribute_model backend_model backend_type backend_table frontend_model frontend_input frontend_label frontend_class source_model is_required is_user_defined default_value is_unique note
83 4 color [NULL] [NULL] int [NULL] [NULL] select Color [NULL] [NULL] 0 1 [NULL] 0 [NULL]
```

acknowledged bug

Most helpful comment

I hope this is useful to somebody, but this is what I'm using on M1:

```
CREATE TABLE catalog_product_entity_int_old LIKE catalog_product_entity_int;
INSERT INTO catalog_product_entity_int_old SELECT * FROM catalog_product_entity_int;

DELETE FROM catalog_product_entity_int
WHERE value_id IN
(SELECT cpei.value_id
FROM catalog_product_entity_int_old cpei
WHERE cpei.attribute_id NOT IN
(SELECT eea.attribute_id
FROM eav_entity_attribute eea
JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id
WHERE cpe.entity_id = cpei.entity_id)
ORDER BY cpei.entity_id);
DROP TABLE catalog_product_entity_int_old;

CREATE TABLE catalog_product_entity_text_old LIKE catalog_product_entity_text;
INSERT INTO catalog_product_entity_text_old SELECT * FROM catalog_product_entity_text;

DELETE FROM catalog_product_entity_text
WHERE value_id IN
(SELECT cpei.value_id
FROM catalog_product_entity_text_old cpei
WHERE cpei.attribute_id NOT IN
(SELECT eea.attribute_id
FROM eav_entity_attribute eea
JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id
WHERE cpe.entity_id = cpei.entity_id)
ORDER BY cpei.entity_id);
DROP TABLE catalog_product_entity_text_old;

CREATE TABLE catalog_product_entity_varchar_old LIKE catalog_product_entity_varchar;
INSERT INTO catalog_product_entity_varchar_old SELECT * FROM catalog_product_entity_varchar;

DELETE FROM catalog_product_entity_varchar
WHERE value_id IN
(SELECT cpei.value_id
FROM catalog_product_entity_varchar_old cpei
WHERE cpei.attribute_id NOT IN
(SELECT eea.attribute_id
FROM eav_entity_attribute eea
JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id
WHERE cpe.entity_id = cpei.entity_id)
ORDER BY cpei.entity_id);
DROP TABLE catalog_product_entity_varchar_old;
```

All 41 comments

@craigcarnell - Same here with CE 2.2.6, investigating...

Hi @craigcarnell

Thank you for reporting the issue. Internal ticket MAGETWO-95789 to investigate and fix it

Same issue with Magento Open Source 2.2.6 with migrated data.

@victor-v-rad any update on this issue?

Not yet. Does it create any issues apart from the warning message in system.log file?

@victor-v-rad no just system.log writes

This issue is created on the M1 side. When in M1 > admin panel > some product has value set for its custom attribute and you remove this attribute from attribute group, then M1 do not clean the value you set for the product. It should remove record from from catalog_product_entity_int)
Hotfix can be removing those records by SQL query

@victor-v-rad In M1 DB I have run:

https://gist.github.com/dfelton/042e15a51b9795b25cad0235a1bf9122#file-magento-ee-1-14-2-0-sql

I have then created a new DB.

However, I still get the following:

[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '219' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '223' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '225' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '332' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '83' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '438' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '501' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '395' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '551' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '253' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '414' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '219' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '223' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '225' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '332' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '83' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []
[2018-11-07 11:08:44] report.WARNING: Attempt to load value of nonexistent EAV attribute '438' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []

Is there any other SQL I need to run?

I do not have this SQL. The issue will be fixed in according ticket

@victor-v-rad:

In my m2 DB:

I've checked eav_attribute for 83 which is color.
It's not assigned any attribute sets.
But there is still values in catalog_product_entity_int.

This is some clean up SQL that I found:

DELETE FROM catalog_product_entity_int 
    WHERE value_id IN 
        (SELECT cpei.value_id 
            FROM catalog_product_entity_int cpei 
            WHERE cpei.attribute_id NOT IN 
                (SELECT eea.attribute_id 
                    FROM eav_entity_attribute eea 
                        JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id 
                    WHERE cpe.entity_id = cpei.row_id) 
        ORDER BY cpei.attribute_id);

Is this correct?

I do however, get this error message when a eav_attribute is still in a set. For example, eav attribute 395 is in 7 attribute sets but it still included in the error message.

[2018-11-14 14:20:31] report.WARNING: Attempt to load value of nonexistent EAV attribute '395' 
                        for entity type 'Magento\Catalog\Api\Data\ProductInterface'. [] []

@craigcarnell

Color has Dropdown input type, hence its values stores in catalog_product_entity_int. But there are many other attributes with other input types, which can store their values in catalog_product_entity_varchar, catalog_product_entity_text, catalog_product_entity_decimal, etc.

@victor-v-rad Is it safe to delete this data in this case, for example - color where the data is not used?

In M2 if you unassign some attribute from an attribute group the values in catalog_product_entity_* tables are cleaned up accordingly. So it should be safe to delete it by SQL query. One more way to delete these values is in Admin Panel assign and unassign these problematic attributes from existing attribute group and Magento should clean catalog_product_entity_* tables

I hope this is useful to somebody, but this is what I'm using on M1:

```
CREATE TABLE catalog_product_entity_int_old LIKE catalog_product_entity_int;
INSERT INTO catalog_product_entity_int_old SELECT * FROM catalog_product_entity_int;

DELETE FROM catalog_product_entity_int
WHERE value_id IN
(SELECT cpei.value_id
FROM catalog_product_entity_int_old cpei
WHERE cpei.attribute_id NOT IN
(SELECT eea.attribute_id
FROM eav_entity_attribute eea
JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id
WHERE cpe.entity_id = cpei.entity_id)
ORDER BY cpei.entity_id);
DROP TABLE catalog_product_entity_int_old;

CREATE TABLE catalog_product_entity_text_old LIKE catalog_product_entity_text;
INSERT INTO catalog_product_entity_text_old SELECT * FROM catalog_product_entity_text;

DELETE FROM catalog_product_entity_text
WHERE value_id IN
(SELECT cpei.value_id
FROM catalog_product_entity_text_old cpei
WHERE cpei.attribute_id NOT IN
(SELECT eea.attribute_id
FROM eav_entity_attribute eea
JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id
WHERE cpe.entity_id = cpei.entity_id)
ORDER BY cpei.entity_id);
DROP TABLE catalog_product_entity_text_old;

CREATE TABLE catalog_product_entity_varchar_old LIKE catalog_product_entity_varchar;
INSERT INTO catalog_product_entity_varchar_old SELECT * FROM catalog_product_entity_varchar;

DELETE FROM catalog_product_entity_varchar
WHERE value_id IN
(SELECT cpei.value_id
FROM catalog_product_entity_varchar_old cpei
WHERE cpei.attribute_id NOT IN
(SELECT eea.attribute_id
FROM eav_entity_attribute eea
JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id
WHERE cpe.entity_id = cpei.entity_id)
ORDER BY cpei.entity_id);
DROP TABLE catalog_product_entity_varchar_old;
```

The above SQL worked for me, going to close this ticket for now.

Re opened as my sql didn't fix everything it would seem

Just to add -- I started noticing this when I just upgraded to 2.2.6 and my system.log and support_report.log started growing exponentially. Each log file was 7GB within 12 hours of a logrotate.

Is it possible the upgrade to 2.2.6 added a bunch of unnecessary data?

These seem to regenerate after moving a product to a new attribute set in the admin. So, that would indicate that Magento isn't cleaning up after itself either, removing orphan values when no longer part of the current attribute set.

This appears to create a considerable slowdown in the process of saving products.

Cleaning the orphans results in an increase in admin speed.

@victor-v-rad Any updates on this issue?

We are having the issue on Magento Open Source 2.2.7 as well.

Same with 2.3.0.

Same 2.3.0

@JamesAllwood in what way are you cleaning the orphan values?

Hi all,

This is what I'm using on M2. It's very similar to the above on M1. I'm not sure why it is required, as this data has already been "cleansed" in M1 before migration?

I have not edited or changed anything in M2 post migration with this one.

Do not try this on live..

CREATE TABLE catalog_product_entity_int_old LIKE catalog_product_entity_int;
INSERT INTO catalog_product_entity_int_old SELECT * FROM catalog_product_entity_int;

DELETE FROM catalog_product_entity_int
    WHERE value_id IN
        (SELECT cpei.value_id
            FROM catalog_product_entity_int_old cpei
            WHERE cpei.attribute_id NOT IN
                (SELECT eea.attribute_id
                    FROM eav_entity_attribute eea
                        JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id
                    WHERE cpe.row_id = cpei.row_id)
        ORDER BY cpei.row_id);
DROP TABLE catalog_product_entity_int_old;

CREATE TABLE catalog_product_entity_text_old LIKE catalog_product_entity_text;
INSERT INTO catalog_product_entity_text_old SELECT * FROM catalog_product_entity_text;

DELETE FROM catalog_product_entity_text
    WHERE value_id IN
        (SELECT cpei.value_id
            FROM catalog_product_entity_text_old cpei
            WHERE cpei.attribute_id NOT IN
                (SELECT eea.attribute_id
                    FROM eav_entity_attribute eea
                        JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id
                    WHERE cpe.row_id = cpei.row_id)
        ORDER BY cpei.row_id);
DROP TABLE catalog_product_entity_text_old;

CREATE TABLE catalog_product_entity_varchar_old LIKE catalog_product_entity_varchar;
INSERT INTO catalog_product_entity_varchar_old SELECT * FROM catalog_product_entity_varchar;

DELETE FROM catalog_product_entity_varchar
    WHERE value_id IN
        (SELECT cpei.value_id
            FROM catalog_product_entity_varchar_old cpei
            WHERE cpei.attribute_id NOT IN
                (SELECT eea.attribute_id
                    FROM eav_entity_attribute eea
                        JOIN catalog_product_entity cpe ON eea.attribute_set_id = cpe.attribute_set_id
                    WHERE cpe.row_id = cpei.row_id)
        ORDER BY cpei.row_id);
DROP TABLE catalog_product_entity_varchar_old;

@snoroozi yes, I have a few queries that do the trick for me. Use at your own risk, and it goes without saying, only use if you have a backup available (also, don't judge me on the sql, I'm sure there's better ways to have written it). These handle values from products and categories, as I found issues there too:

DELETE
    catalog_category_entity_int.*
FROM
    catalog_category_entity_int
JOIN
    catalog_category_entity ON
    catalog_category_entity_int.entity_id = catalog_category_entity.entity_id
LEFT JOIN
    eav_entity_attribute ON
    (
        catalog_category_entity.attribute_set_id = eav_entity_attribute.attribute_set_id
        AND
        catalog_category_entity_int.attribute_id = eav_entity_attribute.attribute_id
    )  
WHERE
    eav_entity_attribute.entity_attribute_id IS NULL;

DELETE
    catalog_category_entity_varchar.*
FROM
    catalog_category_entity_varchar
JOIN
    catalog_category_entity ON
    catalog_category_entity_varchar.entity_id = catalog_category_entity.entity_id
LEFT JOIN
    eav_entity_attribute ON
    (
        catalog_category_entity.attribute_set_id = eav_entity_attribute.attribute_set_id
        AND
        catalog_category_entity_varchar.attribute_id = eav_entity_attribute.attribute_id
    )  
WHERE
    eav_entity_attribute.entity_attribute_id IS NULL;

DELETE
    catalog_category_entity_text.*
FROM
    catalog_category_entity_text
JOIN
    catalog_category_entity ON
    catalog_category_entity_text.entity_id = catalog_category_entity.entity_id
LEFT JOIN
    eav_entity_attribute ON
    (
        catalog_category_entity.attribute_set_id = eav_entity_attribute.attribute_set_id
        AND
        catalog_category_entity_text.attribute_id = eav_entity_attribute.attribute_id
    )  
WHERE
    eav_entity_attribute.entity_attribute_id IS NULL;

DELETE
    catalog_category_entity_decimal.*
FROM
    catalog_category_entity_decimal
JOIN
    catalog_category_entity ON
    catalog_category_entity_decimal.entity_id = catalog_category_entity.entity_id
LEFT JOIN
    eav_entity_attribute ON
    (
        catalog_category_entity.attribute_set_id = eav_entity_attribute.attribute_set_id
        AND
        catalog_category_entity_decimal.attribute_id = eav_entity_attribute.attribute_id
    )  
WHERE
    eav_entity_attribute.entity_attribute_id IS NULL;

DELETE
    catalog_product_entity_int.*
FROM
    catalog_product_entity_int
JOIN
    catalog_product_entity ON
    catalog_product_entity_int.entity_id = catalog_product_entity.entity_id
LEFT JOIN
    eav_entity_attribute ON
    (
        catalog_product_entity.attribute_set_id = eav_entity_attribute.attribute_set_id
        AND
        catalog_product_entity_int.attribute_id = eav_entity_attribute.attribute_id
    )  
WHERE
    eav_entity_attribute.entity_attribute_id IS NULL;

DELETE
    catalog_product_entity_varchar.*
FROM
    catalog_product_entity_varchar
JOIN
    catalog_product_entity ON
    catalog_product_entity_varchar.entity_id = catalog_product_entity.entity_id
LEFT JOIN
    eav_entity_attribute ON
    (
        catalog_product_entity.attribute_set_id = eav_entity_attribute.attribute_set_id
        AND
        catalog_product_entity_varchar.attribute_id = eav_entity_attribute.attribute_id
    )  
WHERE
    eav_entity_attribute.entity_attribute_id IS NULL;

DELETE
    catalog_product_entity_text.*
FROM
    catalog_product_entity_text
JOIN
    catalog_product_entity ON
    catalog_product_entity_text.entity_id = catalog_product_entity.entity_id
LEFT JOIN
    eav_entity_attribute ON
    (
        catalog_product_entity.attribute_set_id = eav_entity_attribute.attribute_set_id
        AND
        catalog_product_entity_text.attribute_id = eav_entity_attribute.attribute_id
    )  
WHERE
    eav_entity_attribute.entity_attribute_id IS NULL;

DELETE
    catalog_product_entity_decimal.*
FROM
    catalog_product_entity_decimal
JOIN
    catalog_product_entity ON
    catalog_product_entity_decimal.entity_id = catalog_product_entity.entity_id
LEFT JOIN
    eav_entity_attribute ON
    (
        catalog_product_entity.attribute_set_id = eav_entity_attribute.attribute_set_id
        AND
        catalog_product_entity_decimal.attribute_id = eav_entity_attribute.attribute_id
    )  
WHERE
    eav_entity_attribute.entity_attribute_id IS NULL;

DELETE 
    catalog_product_entity_datetime.* 
FROM
    catalog_product_entity_datetime
LEFT JOIN
    eav_attribute ON
    catalog_product_entity_datetime.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL;

DELETE 
    catalog_product_entity_decimal.* 
FROM
    catalog_product_entity_decimal
LEFT JOIN
    eav_attribute ON
    catalog_product_entity_decimal.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL;

DELETE 
    catalog_product_entity_int.* 
FROM
    catalog_product_entity_int
LEFT JOIN
    eav_attribute ON
    catalog_product_entity_int.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL;

DELETE 
    catalog_product_entity_text.* 
FROM
    catalog_product_entity_text
LEFT JOIN
    eav_attribute ON
    catalog_product_entity_text.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL;

DELETE 
    catalog_product_entity_varchar.* 
FROM
    catalog_product_entity_varchar
LEFT JOIN
    eav_attribute ON
    catalog_product_entity_varchar.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL;

DELETE 
    catalog_category_entity_datetime.* 
FROM
    catalog_category_entity_datetime
LEFT JOIN
    eav_attribute ON
    catalog_category_entity_datetime.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL;

DELETE 
    catalog_category_entity_decimal.* 
FROM
    catalog_category_entity_decimal
LEFT JOIN
    eav_attribute ON
    catalog_category_entity_decimal.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL;

DELETE 
    catalog_category_entity_int.* 
FROM
    catalog_category_entity_int
LEFT JOIN
    eav_attribute ON
    catalog_category_entity_int.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL;

DELETE 
    catalog_category_entity_text.* 
FROM
    catalog_category_entity_text
LEFT JOIN
    eav_attribute ON
    catalog_category_entity_text.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL;

DELETE 
    catalog_category_entity_varchar.* 
FROM
    catalog_category_entity_varchar
LEFT JOIN
    eav_attribute ON
    catalog_category_entity_varchar.attribute_id = eav_attribute.attribute_id
WHERE
    eav_attribute.attribute_id IS NULL; 

@JamesAllwood Thanks for sharing. Have you noticed any ill effects from doing these? Usually you fix one thing you break another you know?

@victor-v-rad do you have any update on official magento fixes for this issue?

Hi @snoroozi
Not yet, but the tool is open for your contribution

My main job is as a merchant pseudo-developer sysadmin. So don't think I'll
be much help.

On Thu, Mar 7, 2019 at 10:48 AM Victor Rad notifications@github.com wrote:

Hi @snoroozi https://github.com/snoroozi
Not yet, but the tool is open for your contribution


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/magento/data-migration-tool/issues/598#issuecomment-470578652,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACQbJaVUPgi6LuAem7BsLJGy2t8SoF6uks5vUTS1gaJpZM4XKKjk
.

Magento 2.3.0 CE -> Have you checked if the attribute in question has been added to the product attribute_set list?
Clear Magento Cache before checking fix and bashing me, please =)

this is a post migration problem

just try to check hidden files with . prefix owner to be magento owner, it worked for me since the upgrade process will reset everything to default

@emadof85 who are you replying to and what are you talking about exactly?

i am having same issue in Magento 2.2.6, is there any solution exist ?

same with magento 2.2.7

same with magento 2.2.8

I would like to mention that I'm facing the same issue. I've migrated from 1.7 though but the issue is the same and is happening in not only products but categories as well. This issue does have a performance impact when saving products or categories when throwing these warnings. Instead of taking very little time to save, it takes significant more time while looking up missing attributes.

Is there any well proven solution to this problem?

In M 2.2.8 the issue is caused by the way the Magento\Eav\Model\ResourceModel\ReadHandler is populating eav_entities. The log message is misleading. For the sake of simplicity I will talk about the product entity.

The ReadHandler loads all the attribute codes and ids associated with the entity based on the corresponding attribute set.

  foreach ($this->getEntityAttributes($entityType, new DataObject($entityData)) as $attribute) {
            if (!$attribute->isStatic()) {
                $attributeTables[$attribute->getBackend()->getTable()][] = $attribute->getAttributeId();
                $attributesMap[$attribute->getAttributeId()] = $attribute->getAttributeCode();
            }
        }

It then loads all the values from all value tables(catalog_product_entity_varchar|int|etc).
It then uses the attributesMap to map each value to an attribute code.

Each time an attribute value is found that does not have a corespondent in the $attributesMap it logs this message.

 foreach ($connection->fetchAll($unionSelect) as $attributeValue) {
                if (isset($attributesMap[$attributeValue['attribute_id']])) {
                    $entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
                } else {
                    $this->logger->warning(
                        "Attempt to load value of nonexistent EAV attribute '{$attributeValue['attribute_id']}' 
                        for entity type '$entityType'."
                    );
                }
            }

Each time a there is a value on an entity in one of the value tables, that is not in the current used attribute set on that entity, this message will be logged.

There are a couple of options, I'll present two. Both should be approached carefully.

  1. You remove all unused data.
  2. You change the logic of this class and remove the log.

As is, I don't think this is a data_migration_tool (just an opinion) but rather a bizarre way of populating eav entities. The log message is wrong 100% as the attribute might very well exist.

I'm pretty sure this logic was not in all 2.2.x versions as I only started seeing the logs after I upgraded from 2.2.3 -> 2.2.8.

In M 2.2.8 the issue is caused by the way the Magento\Eav\Model\ResourceModel\ReadHandler is populating eav_entities. The log message is misleading. For the sake of simplicity I will talk about the product entity.

The ReadHandler loads all the attribute codes and ids associated with the entity based on the corresponding attribute set.

  foreach ($this->getEntityAttributes($entityType, new DataObject($entityData)) as $attribute) {
            if (!$attribute->isStatic()) {
                $attributeTables[$attribute->getBackend()->getTable()][] = $attribute->getAttributeId();
                $attributesMap[$attribute->getAttributeId()] = $attribute->getAttributeCode();
            }
        }

It then loads all the values from all value tables(catalog_product_entity_varchar|int|etc).
It then uses the attributesMap to map each value to an attribute code.

Each time an attribute value is found that does not have a corespondent in the $attributesMap it logs this message.

 foreach ($connection->fetchAll($unionSelect) as $attributeValue) {
                if (isset($attributesMap[$attributeValue['attribute_id']])) {
                    $entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
                } else {
                    $this->logger->warning(
                        "Attempt to load value of nonexistent EAV attribute '{$attributeValue['attribute_id']}' 
                        for entity type '$entityType'."
                    );
                }
            }

Each time a there is a value on an entity in one of the value tables, that is not in the current used attribute set on that entity, this message will be logged.

There are a couple of options, I'll present two. Both should be approached carefully.

1. You remove all unused data.

2. You change the logic of this class and remove the log.

As is, I don't think this is a data_migration_tool (just an opinion) but rather a bizarre way of populating eav entities. The log message is wrong 100% as the attribute might very well exist.

I'm pretty sure this logic was not in all 2.2.x versions as I only started seeing the logs after I upgraded from 2.2.3 -> 2.2.8.

This is more pertinent to my situation since I only ever upgraded from 2.1.8 to 2.2.6; and referenced attributes in the log do exist so the warning was very confusing for me. For me it references the same attributes constantly (114 - country_of_manufacture & 184 - a custom one I created).

It looks like there was attention given to this issue on GitHub for ReadHandler.php:
https://github.com/magento/magento2/commit/ab27445f80fa8bfc37c26abcbb5ac01a142d6073

Fixed in c5d7b65

@victor-v-rad Thanks 👍 Now migrated onto m2. Not seeing this after running the SQL I mentioned above on M1 followed by M2 cleanup.

Feel free to re-open if anyone else needs it.

Was this page helpful?
0 / 5 - 0 ratings