Movie and TV Posters not Loading After PMS-2058

Server Version#:1.18.2.2058
Player Version#:Plex Web 4.14.2

After updating to PMS-2058, I can’t load new movie posters or TV show artwork.

In my logs, I get an error about the “CloudFlare ID” HTTP header. I have a Ubuntu 18.04 server with all of the latest package updates.

2019-11-25 01:44:40,498 (7fc701ffb700) :  DEBUG (runtime:924) - Response: [500] 2472 bytes
2019-11-25 01:44:40,499 (7fc701ffb700) :  DEBUG (runtime:717) - Handling request GET /system/agents/media/get?guid=com%2Eplexapp%2Eagents%2Eimdb%3A%2F%2Ftt0113243%3Flang%3Den&mediaType=1&url=metadata%3A%2F%2Fart%2Fcom%2Eplexapp%2Eagents%2Eimdb_35ea0d88f9621bb2f1878375132105675ef2e910
2019-11-25 01:44:40,500 (7fc701ffb700) :  DEBUG (runtime:814) - Found route matching /system/agents/media/get
2019-11-25 01:44:40,501 (7fc701ffb700) :  DEBUG (agentservice:1077) - Downloading data for metadata://art/com.plexapp.agents.imdb_35ea0d88f9621bb2f1878375132105675ef2e910 (in com.plexapp.agents.imdb) from http://image.tmdb.org/t/p/original/bqFO92d1idNAI4OOncUrduz2YoA.jpg
2019-11-25 01:44:40,501 (7fc701ffb700) :  DEBUG (networking:143) - Requesting 'http://image.tmdb.org/t/p/original/bqFO92d1idNAI4OOncUrduz2YoA.jpg'
2019-11-25 01:44:40,502 (7fc701ffb700) :  CRITICAL (runtime:889) - Exception (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-e67a4e892/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 843, in handle_request
    result = f(**d)
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-e67a4e892/System.bundle/Contents/Code/agentservice.py", line 1078, in media_get
    data = HTTP.Request(media_url, cacheTime=0).content
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-e67a4e892/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 242, in content
    return self.__str__()
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-e67a4e892/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 220, in __str__
    self.load()
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-e67a4e892/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 158, in load
    f = self._opener.open(req, timeout=self._timeout)
  File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/urllib2.py", line 1228, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/urllib2.py", line 1195, in do_open
    h.request(req.get_method(), req.get_selector(), req.data, headers)
  File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/httplib.py", line 1096, in _send_request
    self.putheader(hdr, value)
  File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/httplib.py", line 1035, in putheader
    raise ValueError('Invalid header value %r' % (one_value,))
ValueError: Invalid header value '__cfduid=d90a9099bb504b82fe3587ca38a2360d21553573513\r'

I dug in and changed the Python library to fix this for now, hoping it’s resolved in a later update or CloudFlare / CloudFront fix the headers.

For anyone else having this problem on Ubuntu 18.04, edit /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/httplib.py

Edit removed by @sa2000 on 21 December 2019

If anyone applied this edit, please uninstall Plex Media Server and download and re-install Plex Media Server

I can confirm this is an issue as I was having the same problems and I’ve been fighting with it for a few days since the 2058 update. You’re fixed worked for me. Hopefully this is fixed in the next Plex update.

@Dreytac Glad this helped someone else!

I need to investigate.

To do so, I need additional information.

Which agents are involved? I tested this thoroughly before I signed off using TMDB and TheTVDB.

I also need full logs ZIP file of it failing to see what’s happening (pre the user-applied patch).

@ChuckPa I’m using TMDB and TheTVDB as well.

I removed my patch on 11/24 after I got the artwork to pull for my TV shows and movies.

I just tried to reproduce the problem today, but the last time I saw the error in the logs was yesterday, 11/25.

Plex Media Server Logs_2019-11-26_20-06-38.zip (2.3 MB)

The file com.plexapp.agents.thetvdb.log.1 starting on line 247 was the last time I saw this pop up.

My best guess is that the problem wasn’t with PMS or TMDB / TheTVDB, but instead with CloudFlare and the way they modified the response headers.

There was a carriage return, but no newline character, so the regex to validate the header failed and the Python library considered it a bad response. I just appended a \n to the header when the regex failed and that worked as a stop gap.

@ChuckPa I spoke too soon. I just added a movie to my library and all of the meta except for the poster loaded.

I see the same error in the Python HTTP library.

Plex Media Server Logs_2019-11-26_20-40-43.zip (2.5 MB)

The metadata refresh didn’t reproduce the issue, but adding a new movie my library allowed me to reproduce it.

I’m working through it.

Please give me some time to go through ALL the agents and see what breaks.

In the mean time, Can you create a parallel library, matching to TMDB as the agent (in the Library Advanced settings)

@ChuckPa I created a parallel TV library using TMDB as the agent.

The series description and episode titles load, but no artwork.

Plex Media Server Logs_2019-11-27_01-05-31.zip (2.8 MB)

Thanks.

Stand by please. I will attempt to recreate.

Recreating with these settings.

278 movies… done… no misses.

We’ll need to figure out why you’re having trouble.

Just applied the latest Plex update and the problem still occurs for me. After re-applying the patch, the poster fetching works fine. I’ve attached my logs.

Plex Media Server Logs_2019-12-18_23-01-50.zip (5.0 MB)

1 Like

Would like to know if everyone getting this issue migrated Plex Media Server from windows to Linux at some point in the past ?

Also would like to have a look zipped copy of each of these files

Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.thetvdb/HTTPCookies

Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.system/HTTPCookies

I did in fact move my library from Windows to Linux.

I’ll post those files later tonight.

HTTPCookies.zip (1.1 KB)

Thank you.

So here we have CR LF as end of line in the cookies lines

com.plexapp.system

com.plexapp.agents.thetvdb

These appear to expire in March and April 2020

My theory is that these came over from a windows install where end of line is CR LF whereas on Linux it is LF. They have long expiry and a recent change to one of the http modules introduced some extra validation tripping over the unexpected carriage return

It should be sufficient to delete these HTTPCookies files and they will get recreated

I would be interested if we do still end up with a CR LF at the end of line after doing this

So just delete

Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.thetvdb/HTTPCookies
and
Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.system/HTTPCookies
and refresh all metadata for the libraries

If still an issue, would like logs and the zipped HTTPCookies files

1 Like

@connor_greene as the problem is now understood and I believe there is a fix as outlined above, could you now remove the changes to the python module /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/httplib.py

For anyone that applied this change, my advice is to re-install to get the correct module as issued

My changes to the httplib.py module were wiped out when I installed PMS-2156.

Deleting the HTTPCookies for TheTVDB and the system seems to have resolved the issue.

Did a full library metadata refresh and everything looks okay.

Thanks for your help!