magento / magento/data-migration-tool

Integrity constraint violation: 1062 Duplicate entry 'XXX-XXX' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'

Open
#823 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
339
Forks
195
PR merge metrics
No merged PRs in 30d

Description

### Preconditions

1. Migrating from Magento 1.9.3.10
2. Migrating to Magento 2.3.5-p1

### Steps to reproduce

1. Run Settings migration as usual
2. Run Data migration as usual

### Expected result

1. Migration with no errors or integrity step failing with details

### Actual result

1. Integrity constraint violation: 1062 Duplicate entry 'XX-XXX' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'

### Additional notes
I have 44 attribute sets in my M1 database. This error only comes up with 2 of the (Attribute set IDs 9 and 12).

I've already checked my M1 & M2 databases and there are no duplicated entries as the error says. Also, this was recognized as a bug on a previous version of [Data Migration Tool](https://github.com/magento/data-migration-tool/issues/201).

The suggested solution was comment/remove remove a method at `Migration/Step/Eav/Data.php` and add the attributes manually to the sets.

Is there a official or tested fix for this?

**Note:** Here is a list with some of the `attribute_set_id` / `attribute_id` combination which fails.

```
Integrity constraint violation: 1062 Duplicate entry '9-110' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'
Integrity constraint violation: 1062 Duplicate entry '9-503' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'
Integrity constraint violation: 1062 Duplicate entry '9-863' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'
Integrity constraint violation: 1062 Duplicate entry '12-111' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'
```

(The same happen to almost all attributes assigned to attribute sets 9 and 12).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Migration/Step/Eav/Data.php and reproducing the Settings and Data migration with the listed Magento versions. Investigate the failing attribute_set_id/attribute_id combinations for sets 9 and 12; done means the migration completes without the duplicate-key error or has a tested, documented resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.