InvalidArgumentException: Accessed unknown getter 'Thread' on XFMG:MediaItem

AndyB

Well-known member
XenForo v2.2.12
Media Gallery v2.2.5

Every time an image is viewed this type of server error log is generated:

Code:
InvalidArgumentException: Accessed unknown getter 'Thread' on XFMG:MediaItem[429] src/XF/Mvc/Entity/Entity.php:213 

Generated by: Unknown account Dec 13, 2022 at 9:32 AM 

Stack trace

#0 src/XF/Mvc/Entity/Entity.php(125): XF\Mvc\Entity\Entity->get('Thread')
#1 internal_data/code_cache/templates/l1/s1/public/reaction_list_row.php(7): XF\Mvc\Entity\Entity->offsetGet('Thread')
#2 src/XF/Template/Templater.php(1652): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#3 src/XF/Template/Templater.php(4067): XF\Template\Templater->renderTemplate('reaction_list_r...', Array)
#4 src/XF/Template/Templater.php(1129): XF\Template\Templater->fnReactions(Object(XF\Template\Templater), false, Object(XFMG\Entity\MediaItem), 'media/reactions', Array)
#5 internal_data/code_cache/templates/l1/s1/public/xfmg_media_view.php(317): XF\Template\Templater->func('reactions', Array)
#6 src/XF/Template/Templater.php(1652): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#7 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('xfmg_media_view', Array)
#8 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#9 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XFMG:Media\\View', 'public:xfmg_med...', Array)
#10 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#11 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#13 src/XF/App.php(2483): XF\Mvc\Dispatcher->run()
#14 src/XF.php(524): XF\App->run()
#15 index.php(20): XF::runApp('XF\\Pub\\App')
#16 {main}

Request state

array(4) {
  ["url"] => string(41) "/xf/media/snipes3-scores-big-in-utah.429/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Last edited:
There will be more to this that requires further troubleshooting.

We cannot reproduce the issue here or in development.

Media items will only have a corresponding Thread relation if they’ve been added through media mirroring.

The Thread relation wouldn’t resolve if the Thread no longer exists but that shouldn’t happen in normal operation.
 
Hi Chris,

I found the problem. The issue was in one of my add-ons, I was hiding the reaction bar data (which user has reacted to a post). To fix the error, I wrapped the code in a <xf:if is="$template == 'thread_view'"> and that corrected the issue.

Sorry to have wasted your time.
 
Back
Top Bottom