magento / magento/data-migration-tool
Undefined offset: error at [stage: data migration][step: EAV Step] for Migration from Magento 1.7.0.2 to Magento 2.3.5
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 339
- Forks
- 195
- PR merge metrics
- No merged PRs in 30d
Description
### Preconditions
1. Magento 1.7.0.2 to Magento 2.3.5.p1
2. PHP 7.2.28
### Steps to reproduce
1. In source database, that is Magento 1.7.0.2, select any attribute_id from "catalog_eav_attribute" table
2. Now remove row of same attribute_id from table "eav_attribute"
3. Execute data migration command
php bin/magento migrate:data -r -a vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.7.0.2/config.xml
or
php bin/magento migrate:data -a vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.7.0.2/config.xml
### Expected result
1.
### Actual result
1. [Screenshot, logs]
Notice: Undefined offset: 144 in /vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 561
### Additional notes
I also executed a query
SET SQL_SAFE_UPDATES = 0;
DELETE FROM catalog_eav_attribute WHERE attribute_id NOT IN (SELECT attribute_id FROM eav_attribute);
DELETE FROM eav_entity_attribute WHERE attribute_id NOT IN (SELECT attribute_id FROM eav_attribute);
SET SQL_SAFE_UPDATES = 1;
which was given at
https://github.com/magento/data-migration-tool/issues/599
and execute data migration command
but then after I am getting another error
syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ORDER BY `
entity_attribute_id` ASC
LIMIT 160' at line 1, query was: SELECT `eav_entity_attribute`.* FROM `eav_entity_attribute` WHERE (`entity_attribute_id` >= 0) AND (attribute_id IN ()) ORDER BY `entity_attribute_id` ASC
LIMIT 160
Attached screenshots for both error.


Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php around line 561 and reproduce the migration using the stated Magento versions and commands. Inspect how the EAV step handles an attribute_id present in catalog_eav_attribute but missing from eav_attribute, including the later empty IN query. Done means this migration path no longer emits the reported undefined-offset notice or malformed SQL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100