Error getting metadata for all new Episodes.

server-linux

#1

Can anyone figure out what might be going on here. All of a sudden all the new episodes that are added to my library, are missing the metadata. When I try to do a manual refresh of the metadata for that epsiode it doesnt retrive anything.

One of the errors I notice is a 404 error on https://meta.plex.tv/tv_e/279536/billions/2016

I have cleared the cache and I still get the same results. The server is on CentOS7.

Here is a snippet of the log.

`2018-06-13 10:01:40,408 (7f8bacff9700) : DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.thetvdb/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKZW5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQozMjI5MHM0CmRiaWRpMApzNwp2ZXJzaW9ubnMxMApwYXJlbnRHVUlEbnM4CnBhcmVudElEczcKVFZfU2hvd3MxMAptZWRpYV90eXBlczQzCmNvbS5wbGV4YXBwLmFnZW50cy50aGV0dmRiOi8vMjc5NTM2P2xhbmc9ZW5zNApndWlkczYKMjc5NTM2czIKaWRyMAo_
2018-06-13 10:01:40,410 (7f8bacff9700) : DEBUG (runtime:49) - Received packed state data (556 bytes)
2018-06-13 10:01:40,412 (7f8bacff9700) : DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.thetvdb/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKZW5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQozMjI5MHM0CmRiaWRpMApzNwp2ZXJzaW9ubnMxMApwYXJlbnRHVUlEbnM4CnBhcmVudElEczcKVFZfU2hvd3MxMAptZWRpYV90eXBlczQzCmNvbS5wbGV4YXBwLmFnZW50cy50aGV0dmRiOi8vMjc5NTM2P2xhbmc9ZW5zNApndWlkczYKMjc5NTM2czIKaWRyMAo_
2018-06-13 10:01:40,414 (7f8bacff9700) : DEBUG (model:32) - Loading model with GUID com.plexapp.agents.thetvdb://279536?lang=en
2018-06-13 10:01:40,416 (7f8bacff9700) : DEBUG (model:234) - Deserializing from /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Metadata/TV Shows/a/6444790b3c46a83fcf8583b76b800b035534a9f.bundle/Contents/com.plexapp.agents.thetvdb/Info.xml
2018-06-13 10:01:40,420 (7f8bacff9700) : DEBUG (networking:166) - Requesting 'http://127.0.0.1:32400/library/metadata/32290/tree'
2018-06-13 10:01:40,530 (7f8bacff9700) : CRITICAL (agentkit:1063) - Exception when constructing media object for dbid 32290 (most recent call last):
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1058, in update
level_attribute_keys=cls._level_attribute_keys)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 678, in TreeForDatabaseID
tree = MediaTree(cls._core, xml_obj[0], level_names, child_id=dbid if parent_id else None, level_attribute_keys=level_attribute_keys)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 557, in __init
_
subitem = MediaTree(self.core, child, next_level_names, level_attribute_keys=next_level_attribute_keys)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 557, in __init
_
subitem = MediaTree(self.core, child, next_level_names, level_attribute_keys=next_level_attribute_keys)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 561, in __init
_
item = MediaItem(self.core, child)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 497, in __init
_
part = MediaPart(self.core, child)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 470, in __init
_
self.subtitles = SubtitlesDirectory(self.core, self._core.storage.join_path(self._path, 'Contents', 'Subtitle Contributions', self._core.identifier))
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 365, in __init
_
self._core.storage.ensure_dirs(self._path)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/storage.py", line 132, in ensure_dirs
self.make_dirs(path)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/storage.py", line 128, in make_dirs
os.makedirs(path)
File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Media/localhost/1/73b005332c39ea29041c4cb4b75cd9324a5a7b0.bundle/Contents/Subtitle Contributions'

2018-06-13 10:01:40,530 (7f8bacff9700) : INFO (init:785) - def update()
2018-06-13 10:01:40,531 (7f8bacff9700) : DEBUG (networking:166) - Requesting 'https://tvdb2.plex.tv/series/279536?lang=en'
2018-06-13 10:01:40,964 (7f8bacff9700) : DEBUG (networking:166) - Requesting 'http://127.0.0.1:32400/services/tmdb?uri=%2Ffind%2F279536%3Fexternal_source%3Dtvdb_id'
2018-06-13 10:01:43,052 (7f8bacff9700) : DEBUG (networking:166) - Requesting 'http://127.0.0.1:32400/services/tmdb?uri=%2Ftv%2F62852%2Frecommendations'
2018-06-13 10:01:45,233 (7f8bacff9700) : DEBUG (networking:166) - Requesting 'https://tvdb2.plex.tv/series/279536/actors'
2018-06-13 10:01:45,592 (7f8bacff9700) : DEBUG (networking:166) - Requesting 'https://meta.plex.tv/tv_e/279536/billions/2016'
2018-06-13 10:01:45,790 (7f8bacff9700) : ERROR (networking:219) - Error opening URL 'https://meta.plex.tv/tv_e/279536/billions/2016'
2018-06-13 10:01:45,795 (7f8bacff9700) : DEBUG (networking:166) - Requesting 'https://tvdb2.plex.tv/series/279536/episodes?page=1'
2018-06-13 10:01:46,190 (7f8bacff9700) : DEBUG (threadkit:244) - Parallel task set UpdateEpisodes ended
2018-06-13 10:01:46,193 (7f8bacff9700) : CRITICAL (agentkit:1078) - Exception in the update function of agent named 'TheTVDB', called with guid 'com.plexapp.agents.thetvdb://279536?lang=en' (most recent call last):
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1076, in update
agent.update(obj, media, lang, **kwargs)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/TheTVDB.bundle/Contents/Code/
init.py", line 897, in update
def UpdateEpisodes():
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/threadkit.py", line 233, in _parallelize_decorator
f(*args, **kwargs)
File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/TheTVDB.bundle/Contents/Code/
init_.py", line 899, in UpdateEpisodes
ordering = media.settings.get('showOrdering', 'aired') if media.settings else 'aired'
AttributeError: 'NoneType' object has no attribute 'settings'

2018-06-13 10:01:46,197 (7f8bacff9700) : DEBUG (model:229) - Serializing to /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Metadata/TV Shows/a/6444790b3c46a83fcf8583b76b800b035534a9f.bundle/Contents/com.plexapp.agents.thetvdb/Info.xml
2018-06-13 10:01:46,200 (7f8bacff9700) : DEBUG (runtime:88) - Sending packed state data (583 bytes)
2018-06-13 10:01:46,200 (7f8bacff9700) : DEBUG (runtime:924) - Response: [200] str, 16 bytes
`


#2

Something changed the permission (possibly ownership) of directories in your /var/lib/plexmediaserver structure.

File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Media/localhost/1/73b005332c39ea29041c4cb4b75cd9324a5a7b0.bundle/Contents/Subtitle Contributions'

Correct this with (big hammer method if needed):

sudo chown -R plex:plex /var/lib/plexmediaserver
sudo find /var/lib/plexmediaserver -type d -exec chmod 755 {} \;
sudo find /var/lib/plexmediaserver -type f -exec chmod 644 {} \;

#3

Thank you, this fixed it. I’m using a python script to refresh my library when rclone detects changes, but when it runs as a service it looks like the files that the plex scanner generates are not under the plex user. I changed the service to run under the plex user, and it looks like its working properly now for new downloads. Thank you!