Fixed Can't delete certain threads and resources

BassMan

Well-known member
I can't delete certain threads and resources (currently 1 resource and 1 thread). I'm getting this:

Server error log
  • XF\Db\Exception: MySQL query error [1048]: Column 'reaction_score' cannot be null
  • src/XF/Db/AbstractStatement.php:228
  • Generated by:
  • 8. jun 2020 ob 22.16
Stack trace
UPDATE xf_user
SET reaction_score = reaction_score - ?
WHERE user_id = ?

------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1048, '23000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1048, '23000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Repository/Reaction.php(536): XF\Db\AbstractAdapter->query('
UPDATE xf...', Array)
#4 src/XF/Entity/Thread.php(1006): XF\Repository\Reaction->fastDeleteReactions('post', Array)
#5 src/XF/Entity/Thread.php(990): XF\Entity\Thread->_postDeletePosts(Array)
#6 src/XF/Mvc/Entity/Entity.php(1595): XF\Entity\Thread->_postDelete()
#7 src/XF/Service/Thread/Deleter.php(71): XF\Mvc\Entity\Entity->delete()
#8 src/XF/Pub/Controller/Thread.php(880): XF\Service\Thread\Deleter->delete('hard', '')
#9 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Thread->actionDelete(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'Delete', Object(XF\Mvc\RouteMatch), Object(SV\AlertImprovements\XF\Pub\Controller\Thread), NULL)
#11 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\AlertImprovements\XF\Pub\Controller\Thread), NULL)
#12 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 src/XF/App.php(2190): XF\Mvc\Dispatcher->run()
#14 src/XF.php(391): XF\App->run()
#15 index.php(20): XF::runApp('XF\\Pub\\App')
#16 {main}
 

BassMan

Well-known member
Actually, I haven't done that yet. The forum is too busy now., but I'll try.

Just wondering what that error means.
 

Mike

XenForo developer
Staff member
Are there any other error logs at the same time?

Have you ever deleted any reaction types in the past? I feel like this is the only cause that I can see.

Also having this in ACP:

Screenshot 2020-06-08 at 22.26.40.png



When I try to run it it just shows me the error again.
Can you confirm that error and backtrace? Even if the message is the same, the code path will be quite different and that will shed some light.
 

BassMan

Well-known member
Thank you for your help, Mike.

Are there any other error logs at the same time?
No.

Have you ever deleted any reaction types in the past?
I used to have Xon's add-on for reactions... I think it was on XF1. I uninstalled it when upgraded to XF2. No errors ever since then.

Can you confirm that error and backtrace? Even if the message is the same, the code path will be quite different and that will shed some light.
The error I get after I run this:

Server error log
  • XF\Db\Exception: MySQL query error [1048]: Column 'reaction_score' cannot be null
  • src/XF/Db/AbstractStatement.php:228
  • Generated by:
  • 9. jun 2020 ob 12.11
Stack trace
UPDATE xf_user
SET reaction_score = reaction_score - ?
WHERE user_id = ?

------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1048, '23000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1048, '23000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Repository/Reaction.php(469): XF\Db\AbstractAdapter->query('
UPDATE x...', Array)
#4 src/XF/Entity/Thread.php(802): XF\Repository\Reaction->fastUpdateReactionIsCounted('post', Array, false)
#5 src/XF/Entity/Thread.php(739): XF\Entity\Thread->threadHidden()
#6 src/XF/Mvc/Entity/Entity.php(1219): XF\Entity\Thread->_postSave()
#7 src/XF/Mvc/Entity/Entity.php(1265): XF\Mvc\Entity\Entity->save(false, false)
#8 src/addons/XFRM/Entity/ResourceItem.php(1110): XF\Mvc\Entity\Entity->saveIfChanged(true, false, false)
#9 src/addons/XFRM/Entity/ResourceItem.php(1246): XFRM\Entity\ResourceItem->resourceHidden(true)
#10 src/XF/Mvc/Entity/Entity.php(1595): XFRM\Entity\ResourceItem->_postDelete()
#11 src/addons/XFRM/Job/CategoryDelete.php(53): XF\Mvc\Entity\Entity->delete(false)
#12 src/XF/Job/Manager.php(253): XFRM\Job\CategoryDelete->run(G)
#13 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
#14 src/XF/Job/Manager.php(79): XF\Job\Manager->runJobEntry(Array, G)
#15 src/XF/Admin/Controller/Tools.php(139): XF\Job\Manager->runQueue(true, 8)
#16 src/XF/Mvc/Dispatcher.php(350): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#17 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(Hampel\LogDigest\XF\Admin\Controller\Tools), NULL)
#18 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Hampel\LogDigest\XF\Admin\Controller\Tools), NULL)
#19 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#20 src/XF/App.php(2190): XF\Mvc\Dispatcher->run()
#21 src/XF.php(391): XF\App->run()
#22 admin.php(13): XF::runApp('XF\\Admin\\App')
#23 {main}


====================================

I can see it that all threads that are causing this error are related to XFRM. Those were the support threads for resources.
 

Mike

XenForo developer
Staff member
Would it be possible for you to submit a ticket with ACP and FTP (or similar) access details? That should allow me to reproduce the issue and confirm what's happening.
 

Mike

XenForo developer
Staff member
This did appear to be related to a deleted reaction (where the reaction entries didn't appear to be cleaned up). I'm not totally sure how we got into that scenario but we now avoid the error anyway.
 
Top