Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined offset: 9 in /vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 433 #112

Closed
quienti opened this issue Jul 11, 2016 · 53 comments

Comments

@quienti
Copy link

quienti commented Jul 11, 2016

Magento 1 => 1.9.2.2
Magento 2 => 2.1.0
Data Migration Tool => 2.1.0

sans titre 1

After try reset :
sans titre 2

@victor-v-rad
Copy link
Collaborator

Hi @quienti
It is hard to figure out what wrong with your eav_attribute_group and eav_entity_attribute.
You could share your DB dump of the next Magento 1 tables:
eav_attribute_group
eav_attribute_set
eav_attribute
eav_entity_attribute
catalog_eav_attribute
customer_eav_attribute
eav_entity_type
You can send it through the email (find it in my profile https://github.com/victor-v-rad)
We will try to migrate it.

@quienti
Copy link
Author

quienti commented Jul 11, 2016

Mail sent and thank you for your response

@quienti quienti closed this as completed Jul 12, 2016
@ilol ilol reopened this Jul 12, 2016
@victor-v-rad
Copy link
Collaborator

internal issue MAGETWO-55303 was created

@trungnguyenbss
Copy link

i'm facing the same problem. Can you post what caused this issue and how to fix? Thanks alot!

@victor-v-rad
Copy link
Collaborator

We are working on this issue. Most probably you have different eav_entity_type.entity_type_id in your Magento 1 and Magento 2

@andreymoskvenkov
Copy link

Ha Ha! I am getting the same error, when migrating from CE 1.9.2.1 to EE 2.1.
But I am getting an error as "undefined offset 13". 13 - it is a "Default" attribute set ID of "order_item" entity type. It falls, when is trying to move "price" attribute to "product-details" group. However "order_item" entity type attributes are not assigned to any attribute group. I think the fix is: do not move such attributes into "product-details" group. Just to change the condition to:
if ($attributes[$attributeId]['attribute_code'] == $attributeCode && isset($attributeSetGroups[$record->getValue('attribute_set_id')][$attributeGroupCode]) ) { $record->setValue( 'attribute_group_id', $attributeSetGroups[$record->getValue('attribute_set_id')][$attributeGroupCode] ); }

@andreymoskvenkov
Copy link

Sh****. Now I get
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '9' for key 'PRIMARY'

@theycallmepepper
Copy link

I just ran into this one as well. (1.8.0.1 -> 2.1.0) @andreymoskvenkov The first answer gives a little more context on the second error you received: http://magento.stackexchange.com/questions/92578/data-migration-eav-step-error

I don't have a solid solution at the moment.

@andreymoskvenkov
Copy link

I think the issue appears, when we have a project, which was initially implemented on some older Magento version and then upgraded many times to the latest version. I have another project on my local, which is on CE 1.9.2.1 as well, but I don't see attributes for "order", "order_item", "invoice", etc entity types in the "eav_attribute" table. Therefore for now I think the solution for me would be: just to delete all attributes from "eav_attribute" table, where entity_type_id > 4. However need to keep in mind that there may be attributes for some custom entity types, which probably should not be deleted. However in my case there I have only Magento entity types.

@andreymoskvenkov
Copy link

Yeah, now I am getting an error related to older backend types:
[ERROR]: Class catalog/product_attribute_backend_finishdate does not exist but mentioned in: eav_attribute.backend_model for attribute_id=63

@victor-v-rad
Copy link
Collaborator

@quienti in your DB the field eav_attribute_group.attribute_group_name has French names. Rename it back to English and try migration again

@quienti
Copy link
Author

quienti commented Jul 27, 2016

I can not try a new migration this week, but as soon as I have a few minutes, I try!
Thanks

@andreymoskvenkov
Copy link

andreymoskvenkov commented Jul 27, 2016

Btw, SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '9' for key 'PRIMARY'
error is thrown, when a rollback is being run. So, rollback does not work in case, when some error occurs.

@andreymoskvenkov
Copy link

Sorry, no, rollback does not work anyway, but this issue Duplicate entry '9' for key 'PRIMARY' is thrown, when Migration tool tries to insert not existing in CE edition entity type "rma_item". This entity type's ID is hardcoded in the Migration tool's helper as "9". Therefore if your eav_entity_type table contains more than 8 "standard" entity types (standard entity types are:
catalog_category
catalog_product
creditmemo
customer
customer_address
invoice
order
shipment
)
then the tool throws an exception, that "Duplicate entry '9'". In our table we have a lot of old entity types, such as "order_item", "invoice_item", etc + we have a custom entity type: "m_filter" from ManaDev extension. Therefore the migration tool would always throw an exception in my case. I have resolved it by deleting all entity types, except entity types from the list above.

@victor-v-rad
Copy link
Collaborator

victor-v-rad commented Jul 27, 2016

This entity type's ID is hardcoded in the Migration tool's helper as "9"

internal ticket MAGETWO-55399 was created

@Nehace40
Copy link

@victor-v-rad i have changed my file like internal issue MAGETWO-55303 but again getting same error

@victor-v-rad
Copy link
Collaborator

@MagentoTest1111 2.1.1 release is not ready yet. It might be better to wait for a while

@baltechies
Copy link

Hi,
I have same issue.
Notice: Undefined offset: 1 in {PROJECT_PATH}/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 433

Magento 1 => 1.9.2.2
Magento 2 => 2.1.0
Data Migration Tool => 2.1.0

@rtowings
Copy link

Hi @baltechies,
Undefined offset 1 in Data.php line 433 is usually a secondary error.
Please empty your Magento2 database, Migrate settings. Then Migrate data using the -vvv flag and post:

  1. your error
  2. the first two lines of the stack trace.

@baltechies
Copy link

Hi @rtowings ,
I have tried it many time and now did it again but same error.
1) Error
[Exception]
Notice: Undefined offset: 1 in /Users/balvinderSingh/Sites/comitstore-mg2/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Dat
a.php on line 433

2) First two lines
Exception trace:
() at /Users/balvinderSingh/Sites/comitstore-mg2/vendor/magento/framework/App/ErrorHandler.php:61
Magento\Framework\App\ErrorHandler->handler() at /Users/balvinderSingh/Sites/comitstore-mg2/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php:433
Migration\Step\Eav\Data->moveAttributeToGroup() at /Users/balvinderSingh/Sites/comitstore-mg2/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php:400

I have attached the screenshot of terminal.
screen shot 2016-08-22 at 9 08 41 pm

@rtowings
Copy link

Hi @baltechies,

Just to be clear. Did you begin your latest attempt with an empty Magento2 database?

@baltechies
Copy link

Yes. I did it with empty Magento2 Database. I have the backup of magento2 database after fresh installation.

@rtowings
Copy link

rtowings commented Aug 22, 2016

OK, try running the following query on your Magento1 database.

select distinct attribute_set_id from eav_attribute_group where attribute_set_id > 8 and attribute_set_id not in (select attribute_set_id from eav_attribute_set where entity_type_id = 4);

@baltechies
Copy link

baltechies commented Aug 22, 2016

I run this query on magent1 database and its return 31 rows.

@baltechies
Copy link

@rtowings Is there any clue? What should I do further?

@rtowings
Copy link

What's going on is that your Magento1 database has some missing data (or extra data, depending on your perspective). Basically, in M1 attributes are grouped into sets in the tables eav_attribute_group and eav_attribute_set. The query you ran on your M1 database returned the attribute_set_id numbers that exist in eav_attribute_group and should (but don't) exist in eav_attribute_set. This is likely due to a bug in an earlier Magento release that deleted the attribute_groups, but did not delete the corresponding sets.

You have 3 choices:

  1. add the missing records to eav_attribute_set in your M1 database.
  2. delete the extra records from eav_attribute_group in your M1 database - I dislike this option, because there is risk in destroying data, but it should work. (make sure you backup first!)
  3. wait for an update in the migration tool that might look for this issue and take appropriate action.

I'll message you separately with some instructions.

@baltechies
Copy link

@rtowings Thank you. I will look into database and update you. I have checked database roughly and found that eav_attribute_set table has entry which is not exist in eav_attribute_group table.

@baltechies
Copy link

@rtowings All attribute_set_id numbers that exist in eav_attribute_group are also exist in eav_attribute_set. I am not capturing what is going wrong here.

@rtowings
Copy link

rtowings commented Aug 22, 2016

[Edited]
Hi @baltechies.

I am concerned that there are issues with your empty M2 database. Before going any farther, I would recommend that you re-run your install (dump this new, empty M2 db for later reference), then attempt the migration into the newly created, empty M2 database. Please remember to use the -vvv flag. (You will still receive an error during the EAV step, but I think it will be slightly different);

The query I had you run earlier on your M1 database [[select distinct attribute_set_id from eav_attribute_group where attribute_set_id > 8 and attribute_set_id not in (select attribute_set_id from eav_attribute_set where entity_type_id = 4);]] returns a list of attribute_set_id that DO exist in eav_attribute_group, but DO NOT exist in eav_attribute_set.

To rule out sets from other entities, here is a slightly modified query to run against your M1 database that should (but may not) yield the same result:
select distinct attribute_set_id from eav_attribute_group where attribute_set_id > 8 and attribute_set_id not in (select attribute_set_id from eav_attribute_set);
If this query yields 0 rows, then we need to look elsewhere for your problem.

If it yields any rows, then it has found a set(s) in eav_attribute_group that doesn't exist in eav_attribute_set;

@baltechies
Copy link

Hi @rtowings
I have installed fresh copy of magento 2.1 and run migration on this. But same issue nothing change.

I have run "select distinct attribute_set_id from eav_attribute_group where attribute_set_id > 8 and attribute_set_id not in (select attribute_set_id from eav_attribute_set);" and its return 0 rows.

@victor-v-rad
Copy link
Collaborator

Please check that in your DB the field eav_attribute_group.attribute_group_name in English.

@baltechies
Copy link

@victor-v-rad There are 127 rows. What should I check?

@baltechies
Copy link

@victor-v-rad Its seems that there is an issue in data migration tool version 2.1.
I installed a fresh copy of magento 2.0.7 and data migration tool version 2.0.7. Then I am able to migrate magento1 database into magento2.
Now I am facing is a new issue, I am unable to edit and add new product, Its showing empty screen.
Can you please suggest related to this?
screen shot 2016-08-30 at 3 31 03 pm

@victor-v-rad
Copy link
Collaborator

@quienti
The issue was fixed in the latest release of the tool 2.1.1
Please recheck

@quienti
Copy link
Author

quienti commented Sep 5, 2016

@victor-v-rad Thank you, I will check in a few days

@baltechies
Copy link

baltechies commented Sep 6, 2016

@victor-v-red
I am able to migrate data from magento 1 to magento 2.1 with data migration tool 2.1.1.
But I faced some issues, Like

  1. products and categories are not shown on frontend.
  2. In admin panel, category page (Product-> categories) throwing exception error. Error is
    a:4:{i:0;s:139:"Notice: Undefined offset: 564 in [Magento_PATH]/vendor/magento/module-eav/Model/ResourceModel/ReadHandler.php on line 166";i:1;s:6828:"#0

@victor-v-rad
Copy link
Collaborator

@baltechies
Not able to identify the cause. You could send your DB dump (remove all passwords in it before). See my email in my profile https://github.com/victor-v-rad
I would try to migrate and test

@victor-v-rad
Copy link
Collaborator

Thank you @baltechies for the DB you sent
Migrated successfully and the issues you described are exist. In order to solve it I need new issue in github please make it and Copy/Past your last comment

@baltechies
Copy link

@victor-v-rad
I have created a new issue #153

@victor-v-rad
Copy link
Collaborator

It seems the initial issue is fixed and I close it. Feel free to reopen if it is still actual

@quienti
Copy link
Author

quienti commented Sep 14, 2016

Just for information, my migration work correctly

Thanks

@ilol
Copy link

ilol commented Sep 14, 2016

Great!

@techverx
Copy link

Hi guyz, I migrated data from magento 1.9.2.4 to magento 2.1.1 and successfully completed all steps. Everything looks good and all data imported but when i go to Products->categories i am seeing this error.

Notice: Undefined offset: 31 in /var/www/coral/vendor/magento/module-eav/Model/ResourceModel/ReadHandler.php on line 166

Help much appreciated. :)

@victor-v-rad
Copy link
Collaborator

It is hard to figure out what is wrong in your case
You could share DB dump (remove all passwords before) of Magento 1 and send it through email (find it in my profile https://github.com/victor-v-rad)
We will try to migrate it to reproduce and fix

@myselfgaurav
Copy link

I am stuck since 3 days trying to migrate my magento 1 to magento 2.
I keep on getting below error:

[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '136' for key 'PRIMARY'

i did reset and did reset multiple times still no success , how can i find which database has duplicate value , please help me to fix i have attached my magento 1 database also .(to you in seperate mail)

@lano-vargas
Copy link

I am also having issue with migrating from 1.9.2.1 to 2.1.0.

In the first run I get [Exception]
Notice: Undefined offset: 1 in ../../../magento2/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 209
Second run I get [PDOException]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-Migration_Default' for key 'EAV_ATTRIBUTE_SET_ENTITY_TYPE_ID_ATTRIBUTE_SET_NAME'

I am not sure how to fix pass this issue, has anyone got a solution please share. thank's.

@PradeepAvion
Copy link

[Exception]
Notice: Undefined offset: 19 in /home/bestalzheimers/public_html/newbestalzheimers/vendor/magento/data-migration-tool/src/Migration/Step/Ea
v/Data.php on line 249

Magento 1 => 1.9.1.0
Magento 2 => 2.1.2
Data Migration Tool => 2.1.2

screenshot from 2017-05-17 12 52 44

@natsoman
Copy link

i am trying to migrate 1.7.0.2 to 2.1.7
[Exception] Notice: Undefined offset: 19 in /home/m2/public_html/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 278

I don't know how to fix it

screen shot 2017-06-22 at 00 34 08

@manojroka
Copy link

@natsoGR did you find any fix for it? I am getting the exactly same error.

@natsoman
Copy link

@manojroka unfortunately no.

@manojroka
Copy link

@natsoGR I restarted the migration process with fresh install and correct ignore documents list, It is now completed without any errors [migration 1.7.0.2 to 2.1.7].

@patadeloso
Copy link

Has anyone nailed down a solution for this? Seen this happen on 1.7.x=>2.1.7 and 1.9.x=>2.1.7.

@wajahatbashir
Copy link

Hi Guys, I migrated data from magento 1.9.2 to magento 2.1.2 and successfully Category step. Everything looks good and all data imported but when i go to Products->categories i am facing this error.

Notice: Undefined offset: 31 in /var/www/coral/vendor/magento/module-eav/Model/ResourceModel/ReadHandler.php on line 166

How to i can fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests