XF 1.4 vb3 import error with attachments


Well-known member
Firstly, confession time - I'm only running php 5.2 on the server at the moment.

I know xenforo advise 5.4 minimum but this was only intended as a test install to explore the import process from vb3.8, and see what would be required with the overall process.

Everything has appeared to work - except that when importing attachments, the import has stopped on a page of error messages:

Server Error
Mysqli statement execute error : Duplicate entry '4994' for key 'PRIMARY'

  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/vBulletin.php at line 3043
  10. XenForo_Importer_vBulletin->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/sffchrom/public_html/admin.php at line 13
The question is, are these caused by using php 5.2 rather than 5.4?

Or, as I suspect, is there something else at play here?


XenForo developer
Staff member
This isn't related to PHP 5.2. It's picked up a duplicate attachment somehow. The main guess is that something fell over and the request was resubmitted. If you look in your XF DB's xf_attachment and xf_attachment_data tables, try removing the records for ID 4994 from each. It should be able to continue, though if my first hypothesis is correct, then there may be other duplicates. At that point, I would suggest removing the records from these 2 tables with ID 4994 or higher (the import step will reinsert them).


Well-known member
Many thanks for the reply - it sounds like it might be simpler to just empty the tables for xf_attachment, xf_attachment_data, and xf_attachment_view, and see if the importer will continue the attachments from the beginning.

Does that sound like a logical plan?

Am trying to be careful here. :)


XenForo developer
Staff member
The importer will pick up from where it left off, so you would lose any attachments it already imported.