Fixed XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '241-0' for key 'PRIMARY' src/XF/Db/AbstractStatement.php:228

Affected version
2.2.2

MilkyMeda

Active member
INSERT INTO xf_search_forum_cache_user (node_id, user_id, results, cache_date) VALUES (?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1062, '23000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1062, '23000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(218): XF\Db\AbstractAdapter->query('INSERT INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1510): XF\Db\AbstractAdapter->insert('xf_search_forum...', Array, false)
#5 src/XF/Mvc/Entity/Entity.php(1242): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Mvc/Entity/Entity.php(1312): XF\Mvc\Entity\Entity->save(true, true)
#7 src/XF/Entity/SearchForum.php(169): XF\Mvc\Entity\Entity->saveIfChanged()
#8 src/XF/Pub/Controller/SearchForum.php(45): XF\Entity\SearchForum->getUserCacheForUser(Object(XF\Entity\User), false)
#9 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\SearchForum->actionView(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:SearchForum', 'View', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\SearchForum), Object(XF\Mvc\Reply\Reroute))
#11 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\SearchForum), Object(XF\Mvc\Reply\Reroute))
#12 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 src/XF/App.php(2300): XF\Mvc\Dispatcher->run()
#14 src/XF.php(488): XF\App->run()
#15 index.php(20): XF::runApp('XF\\Pub\\App')
#16 {main}
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.3).

Change log:
Prevent an error from a race condition related to search forum cache generation.
There may be a delay before changes are rolled out to the XenForo Community.
 
Top