Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'

Magento Asked on December 20, 2020

I’m trying to migrate from Magento 1 to 2 and when I get to this part:

[2017-10-06 14:04:36][INFO][mode: data][stage: data migration][step: Map Step]: started
33% [=========>——————] Remaining Time: 3 mins

I then get this error

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘0’ for key ‘PRIMARY’

Any ideas?

4 Answers


worked for me inside the map.xml (or map.xml.dist) source -> field_rules node

Answered by DKNZDESIGN on December 20, 2020

The problem should go away if you change bulk_size to something other than 0 in your config.xml. It doesn't seem to auto-detect correctly on the customer_group table. Setting mine to 100 solved the problem for me.

To find out what table is the problem, try adding some debugging info to your src/Migration/Step/Map/Data.php file. Something like $this->logger->info("DEBUG: " . $sourceDocName ); around line 136. This should output the table the migration tool is currently working on in the console.

Answered by Sean Michaud on December 20, 2020

I had the same problem.. to get past it at least temporarily, I added this to the map.xml file under source and under document_rules


Answered by Anthony B on December 20, 2020

I am getting the same error. When doing the migration with verbose mode on, I can see that the issue is with the "customer_group" table. Primary key 0 is the "NOT LOGGED IN" customer group.

That is how far I am into for now. I will let you know if I find anything else.

Answered by Wesley J on December 20, 2020

Add your own answers!

Related Questions

How does Magento 2 ACL works

2  Asked on December 22, 2021 by adarsh-khatri


How to redirect a category to another link?

4  Asked on December 19, 2021 by elham-gdz


Changing product’s Sort By default

1  Asked on December 19, 2021 by luenib


Print Magento Invoice Data To TCPDF File

1  Asked on December 17, 2021 by reshad-zazai


Klarna payment option not showing Magento 2.3

2  Asked on December 17, 2021 by user3091199


payment required after 30 days module

0  Asked on December 17, 2021 by alain-seys


To add default filter to grid in Magento2?

5  Asked on December 14, 2021 by draji


Magento 2: How to remove decimal points from the price

8  Asked on December 14, 2021 by chamal-chamikara


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP