XF 1.4 VB 4.x Import: Mysqli statement execute error : Duplicate entry '19058' for key 'PRIMARY


New member
I have previously searched the forum and note that Brogan suggests hitting refresh until it sorts itself.

I am importing a large VB database and over 24hrs in and numerous refreshes/reloads for similar messages (and timeouts) we are almost there and I get the above message - except this time, it won't go away.

I have refreshed countless times and the message persists.

Is there anything else I can do to get this completed?

Thank you


New member
Yes, looking at the rest of the message (apologies, I should have posted this already):

  1. Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 297
  2. Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
  3. Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
  4. Zend_Db_Adapter_Abstract->insert() in XenForo/DataWriter.php at line 1624
  5. XenForo_DataWriter->_insert() in XenForo/DataWriter.php at line 1613
  6. XenForo_DataWriter->_save() in XenForo/DataWriter.php at line 1405
  7. XenForo_DataWriter->save() in XenForo/Model/Import.php at line 1890
  8. XenForo_Model_Import->importAttachment() in XenForo/Model/Import.php at line 1936
  9. XenForo_Model_Import->importPostAttachment() in XenForo/Importer/vBulletin4x.php at line 114
  10. XenForo_Importer_vBulletin4x->stepAttachments() in XenForo/Importer/Abstract.php at line 97
  11. XenForo_Importer_Abstract->runStep() in XenForo/ControllerAdmin/Import.php at line 187
  12. XenForo_ControllerAdmin_Import->_runStep() in XenForo/ControllerAdmin/Import.php at line 135
  13. XenForo_ControllerAdmin_Import->actionImport() in XenForo/FrontController.php at line 347
  14. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
  15. XenForo_FrontController->run() in /home/xxx/forums.x.com/x/admin.php at line 13
Last edited:


XenForo developer
Staff member
Last time I dealt with this problem, there was actually an image that was crashing PHP when it was opened to check its EXIF info.

The main way to workaround this is to look in the xf_attachment table and find any entries with an ID of
19058 or higher and delete them. You can then try to refresh the page. (You can repeat this process using the ID shown in the error message.)

If the problem comes back, it could indicate some sort of timeout/memory limit or it could indicate that there's actually a bad image there. Identifying the bad image may be possible by finding the highest ID inserted into XF by the import and then looking at the next ID higher than that in your source DB (eg, if the highest value in the xf_attachment table is 5, look for the source value with ID 6 [or 7 or 8...]).

If you're not sure how to handle this, if you submit FTP and ACP details via a ticket, I can probably workaround it.


New member
Hey Mike,

Thanks for the response. That kind of makes sense to me. I'll nip into phpmyadmin and take a look and see if I can resolve. I'll come back to you if it does not solve the issue.

Thanks again for your help.