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?

  • did you try to delete this record from that particular table ? if not then do this after take database backup then perform. – Hardik Visa Sep 11 '19 at 16:35

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.


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.

  • How do you know which table is causing the issue? – Fred Oct 9 '17 at 8:21

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.