Server Error / Duplicate Entry

Onimua

Well-known member
When trying to run the upgrade, it stalls almost as soon as it starts with this:

Code:
Server Error

Mysqli statement execute error : Duplicate entry '1147-0' for key 'definition_id_style_id'

   1. Zend_Db_Statement_Mysqli->_execute() in /Applications/MAMP/htdocs/XenForo/library/Zend/Db/Statement.php at line 297
   2. Zend_Db_Statement->execute() in /Applications/MAMP/htdocs/XenForo/library/Zend/Db/Adapter/Abstract.php at line 479
   3. Zend_Db_Adapter_Abstract->query() in /Applications/MAMP/htdocs/XenForo/library/Zend/Db/Adapter/Abstract.php at line 574
   4. Zend_Db_Adapter_Abstract->insert() in /Applications/MAMP/htdocs/XenForo/library/XenForo/DataWriter.php at line 1500
   5. XenForo_DataWriter->_insert() in /Applications/MAMP/htdocs/XenForo/library/XenForo/DataWriter.php at line 1489
   6. XenForo_DataWriter->_save() in /Applications/MAMP/htdocs/XenForo/library/XenForo/DataWriter.php at line 1291
   7. XenForo_DataWriter->save() in /Applications/MAMP/htdocs/XenForo/library/XenForo/Model/StyleProperty.php at line 1180
   8. XenForo_Model_StyleProperty->updateStylePropertyValue() in /Applications/MAMP/htdocs/XenForo/library/XenForo/Model/StyleProperty.php at line 2272
   9. XenForo_Model_StyleProperty->importStylePropertiesFromArray() in /Applications/MAMP/htdocs/XenForo/library/XenForo/Model/StyleProperty.php at line 2146
  10. XenForo_Model_StyleProperty->importStylePropertyXml() in /Applications/MAMP/htdocs/XenForo/library/XenForo/Model/StyleProperty.php at line 2079
  11. XenForo_Model_StyleProperty->importStylePropertyDevelopmentXml() in /Applications/MAMP/htdocs/XenForo/library/XenForo/CacheRebuilder/ImportMasterData.php at line 42
  12. XenForo_CacheRebuilder_ImportMasterData->rebuild() in /Applications/MAMP/htdocs/XenForo/library/XenForo/ControllerHelper/CacheRebuild.php at line 26
  13. XenForo_ControllerHelper_CacheRebuild->rebuildCache() in /Applications/MAMP/htdocs/XenForo/library/XenForo/Install/Controller/Upgrade.php at line 181
  14. XenForo_Install_Controller_Upgrade->actionRebuild() in /Applications/MAMP/htdocs/XenForo/library/XenForo/FrontController.php at line 310
  15. XenForo_FrontController->dispatch() in /Applications/MAMP/htdocs/XenForo/library/XenForo/FrontController.php at line 132
  16. XenForo_FrontController->run() in /Applications/MAMP/htdocs/XenForo/install/index.php at line 17
Not sure where I should look or what to do to try and resolve it.
 

Mike

XenForo developer
Staff member
Not something I've seen before. Does it happen on a refresh? Do you have any add-ons installed?

Can you dump the contents of the xf_style_property, xf_style_property_definition, and xf_style_property_group tables?
 

Onimua

Well-known member
I disabled add-ons before upgrading, and I do have a couple of styles but I have been able to upgrade previously with no issues. I've tried rerunning it but it doesn't want to go through.

I had also created style property groups but deleted them; would that have any effect on this?
 

Attachments

Onimua

Well-known member
Actually, if I try rerunning it, it increments the ID error.

Code:
Mysqli statement execute error : Duplicate entry '1148-0' for key 'definition_id_style_id'
It's now '1148'.
 

Mike

XenForo developer
Staff member
Well, I can reproduce it with your data, so that's a good sign... :)
 

Mike

XenForo developer
Staff member
Aha, the reason is that you have style properties that correspond to definitions that don't exist (1144 - 1148). I'm not totally sure how this would happen. That explains why it fixes itself after one run, as 1148 is the last conflict.
 

Onimua

Well-known member
Aha, the reason is that you have style properties that correspond to definitions that don't exist (1144 - 1148). I'm not totally sure how this would happen. That explains why it fixes itself after one run, as 1148 is the last conflict.
Hm... what if I created a style property group, then created options with in it but deleted it. And it just so happens they don't get removed because XenForo doesn't delete them from the database... I happen to notice and delete them manually. This was related to this bug I reported earlier.

And... after double checking, it's present in RC3 (not deleting the group/definitions even though you select Delete and confirm it). Guess it's a bug?

Does that mean if I run the install again it should work and there shouldn't be any problems in the future from this?
 

Mike

XenForo developer
Staff member
Yeah, the next run should get you out of the overlapping elements and it will import correctly.

If you're finding that things aren't deleted when you expect, please report that as a bug.
 
Top