Taxel / PlexTraktSync

A python script that syncs the movies, shows and ratings between trakt and Plex (without needing a PlexPass or Trakt VIP subscription)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plex 500 internal error with index=None

digitalgp opened this issue · comments

Confirmation

  • I have read the README.md on the project homepage
  • I have checked if identical issue already exists
  • I have tried downgrading to find version that can be used as a workaround

The problem

i got this error in the plex console when running plextraktsync.

Got exception from request handler: sqlite3_statement_backend::prepare: no such column: None for SQL: select count(*) from (select distinct(metadata_items.id) from metadata_items join metadata_items as parents on metadata_items.parent_id=parents.id join metadata_items as children on children.parent_id=metadata_items.id where metadata_items.library_section_id in (1) and (metadata_items.`index`=None and metadata_items.metadata_type=3 and metadata_items.parent_id=66153) )

anyone seen this? and have a fix? is it the plextraktsync thats broken?

Error trace / logs

2023-11-14 22:59:45,270 ERROR[PlexTraktSync]:(500) internal_server_error; https://192-168-10-20.29069781034849ab98845e008b75f47c.plex.direct:32400/library/metadata/66153/children?excludeAllLeaves=1&index=None <html><head><title>Internal Server Error</title></head><body><h1>500 Internal Server Error</h1></body></html>
Traceback (most recent call last):
  File "/app/plextraktsync/cli.py", line 26, in wrap
    cmd(*args, **kwargs)
  File "/app/plextraktsync/commands/sync.py", line 68, in sync
    runner.sync(walker=w, dry_run=config.dry_run)
  File "/app/plextraktsync/sync.py", line 79, in sync
    for episode in walker.find_episodes():
  File "/app/plextraktsync/walker.py", line 303, in find_episodes
    yield from self.episode_from_show(show)
  File "/app/plextraktsync/walker.py", line 343, in episode_from_show
    me = self.mf.resolve_any(pe, show)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/plextraktsync/media.py", line 252, in resolve_any
    m = self.resolve_guid(guid, show)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/plextraktsync/media.py", line 260, in resolve_guid
    logger.warning(f"{guid.pm.item}: Skipping {guid} because provider {guid.provider} has no external Id")
                     ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/video.py", line 975, in __repr__
    f"{self.grandparentTitle.replace(' ', '-')[:20]}-{self.seasonEpisode}",
                                                      ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/base.py", line 516, in __getattribute__
    value = super(PlexPartialObject, self).__getattribute__(attr)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/video.py", line 1011, in seasonEpisode
    return f's{str(self.seasonNumber).zfill(2)}e{str(self.episodeNumber).zfill(2)}'
                   ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/base.py", line 516, in __getattribute__
    value = super(PlexPartialObject, self).__getattribute__(attr)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/functools.py", line 995, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/video.py", line 1006, in seasonNumber
    return self.parentIndex if isinstance(self.parentIndex, int) else self._season.seasonNumber
                                                                      ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/base.py", line 516, in __getattribute__
    value = super(PlexPartialObject, self).__getattribute__(attr)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/functools.py", line 995, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/video.py", line 966, in _season
    return self.fetchItem(
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/base.py", line 307, in fetchItem
    return self.fetchItems(ekey, cls, **kwargs)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/base.py", line 255, in fetchItems
    data = self._server.query(ekey, headers=headers)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plexapi/server.py", line 770, in query
    raise BadRequest(message)
plexapi.exceptions.BadRequest: (500) internal_server_error; https://192-168-10-20.29069781034849ab98845e008b75f47c.plex.direct:32400/library/metadata/66153/children?excludeAllLeaves=1&index=None <html><head><title>Internal Server Error</title></head><body><h1>500 Internal Server Error</h1></body></html>

Expected behavior

sync

Steps to reproduce the behavior

running plextraktsync

Inspect of problematic items

No response

Workarounds

No response

Install method

Unraid installation (not supported)

Config file contents

No response

Version

0.27.11

Python Version

3.12.0

Operating System and Version

unraid

Can you type the command plextraktsync inspect 66153 and show the output ?

Version latest is not an correct answer, we need to know the version number (Ex. 0.27.x)

Inspecting 66153: <tmdb:22980:Show:66153:Watch-What-Happens-L>
Library: TV-serier
Plex Web URL: https://app.plex.tv/desktop/#!/server/43d77eba004ced702dcd453d929ae341d7018c01/details?key=/library/metadata/66153
Discover URL: 
https://app.plex.tv/desktop/#!/provider/tv.plex.provider.discover/details?key=/library/metadata/5d9f400906d220001fec16f5
Title: Watch What Happens Live with Andy Cohen
Media.Type: 'show'
Media.Guid: 'plex://show/5d9f400906d220001fec16f5'
Media.Guids: [<Guid:imdb://tt2057880>, <Guid:tmdb://22980>, <Guid:tvdb://230991>]
Guids:
  Guid: <PlexGuid:tmdb://22980>, Id: 22980, Provider: 'tmdb'
  Guid: <PlexGuid:tvdb://230991>, Id: 230991, Provider: 'tvdb'
  Guid: <PlexGuid:imdb://tt2057880>, Id: tt2057880, Provider: 'imdb'
Metadata: {'collected_at': '2023-10-18:T21:57:48.000Z', 'media_type': 'digital'}
Trakt: https://trakt.tv/shows/22878
Plex Rating: None
Trakt Rating: None
Watched on Plex: False
Plex play history:

version is 0.27.11

As a temporary workaround, you could try using old plexapi version 4.15.1

@pterisaur Can you type the command plextraktsync inspect 539544 to find which of your TV Show is guilty ?

Then in this TV Show settings in Plex, check Advanced > Seasons and toggle it to Show if it's Hidden. Then refresh the show, remove cache and run a sync again.
Same thing for you @digitalgp

Refs :

Can you post the raw Plex XML for those episodes?

the show was set to show in seasons show/hidden

here are from one of the episodes:

<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="1" librarySectionTitle="TV-serier" librarySectionUUID="3060f917-27c3-4f0a-b544-85a0d7c06425" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1695752579">
<Video ratingKey="66155" key="/library/metadata/66155" parentRatingKey="66154" grandparentRatingKey="66153" guid="local://66155" parentGuid="local://66154" grandparentGuid="plex://show/5d9f400906d220001fec16f5" type="episode" title="Episode 10-12" grandparentKey="/library/metadata/66153" parentKey="/library/metadata/66154" librarySectionTitle="TV-serier" librarySectionID="1" librarySectionKey="/library/sections/1" grandparentTitle="Watch What Happens Live with Andy Cohen" contentRating="TV-14" summary="" viewOffset="100609" viewCount="1" lastViewedAt="1699886558" year="2009" thumb="/library/metadata/66155/thumb/1697666271" art="/library/metadata/66153/art/1700110966" grandparentThumb="/library/metadata/66153/thumb/1700110966" grandparentArt="/library/metadata/66153/art/1700110966" duration="1302037" originallyAvailableAt="2023-10-11" addedAt="1697666268" updatedAt="1697666271">
<Media id="90431" duration="1302037" bitrate="9759" width="1280" height="720" aspectRatio="1.78" audioChannels="2" audioCodec="aac" videoCodec="h264" videoResolution="720" container="mkv" videoFrameRate="NTSC" audioProfile="lc" videoProfile="high">
<Part accessible="1" exists="1" id="90654" key="/library/parts/90654/1697644686/file.mkv" duration="1302037" file="/media/series/Watch What Happens Live with Andy Cohen (2009) {imdb-tt2057880}/Watch.What.Happens.Live.2023.10.12.720p.WEB.h264-EDITH.mkv" size="802370465" audioProfile="lc" container="mkv" deepAnalysisVersion="6" requiredBandwidths="6058,5528,5177,5177,5177,5177,5177,5177" videoProfile="high">
<Stream id="444242" streamType="1" default="1" codec="h264" index="0" bitrate="4831" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" closedCaptions="1" codedHeight="720" codedWidth="1280" colorPrimaries="bt709" colorRange="tv" colorSpace="bt709" colorTrc="bt709" frameRate="29.970" hasScalingMatrix="0" height="720" level="31" profile="high" refFrames="3" requiredBandwidths="5961,5432,5082,5082,5082,5082,5082,5082" scanType="progressive" width="1280" displayTitle="720p (H.264)" extendedDisplayTitle="720p (H.264)"> </Stream>
<Stream id="444244" streamType="2" selected="1" default="1" codec="aac" index="1" channels="2" bitrate="96" language="engelsk" languageTag="en" languageCode="eng" audioChannelLayout="stereo" profile="lc" requiredBandwidths="96,96,96,96,96,96,96,96" samplingRate="48000" displayTitle="engelsk (AAC Stereo)" extendedDisplayTitle="engelsk (AAC Stereo)"> </Stream>
<Stream id="444243" streamType="3" codec="eia_608" index="0" bitrate="4831" embeddedInVideo="1" requiredBandwidths="5961,5432,5082,5082,5082,5082,5082,5082" displayTitle="Ukjent (Closed Captions)" extendedDisplayTitle="Ukjent (Closed Captions)"> </Stream>
<Stream id="444245" streamType="3" selected="1" codec="srt" index="2" bitrate="0" language="engelsk" languageTag="en" languageCode="eng" requiredBandwidths="1,1,1,1,1,1,1,1" title="English" displayTitle="engelsk (SRT)" extendedDisplayTitle="English (SRT)"> </Stream>
</Part>
</Media>
<Extras size="0"> </Extras>
<Related> </Related>
</Video>
</MediaContainer>

@pterisaur Can you type the command plextraktsync inspect 539544 to find which of your TV Show is guilty ?

Then in this TV Show settings in Plex, check Advanced > Seasons and toggle it to Show if it's Hidden. Then refresh the show, remove cache and run a sync again. Same thing for you @digitalgp

It was hidden. When I run the inspect, here's the result. By "refresh" do you mean refresh metadata on this show? By "remove cache" are you referring to the user Library/Caches folder?

PlexTraktSync [0.27.10]

Inspecting 539544: <tmdb:139656:Show:539544:Mister-Epic-Mann>
Library: TV Shows
Plex Web URL: 
https://app.plex.tv/desktop/#!/server/07c3b0207280454ebf1b078276a94e75588392d3/details?key=/library/met
adata/539544
Discover URL: 
https://app.plex.tv/desktop/#!/provider/tv.plex.provider.discover/details?key=/library/metadata/61a5100
ac07701d97c9d6110
Title: Mister Epic Mann
Media.Type: 'show'
Media.Guid: 'plex://show/61a5100ac07701d97c9d6110'
Media.Guids: [<Guid:tmdb://139656>, <Guid:tvdb://412967>]
Guids:
  Guid: <PlexGuid:tmdb://139656>, Id: 139656, Provider: 'tmdb'
  Guid: <PlexGuid:tvdb://412967>, Id: 412967, Provider: 'tvdb'
Metadata: {'collected_at': '2023-07-16:T19:12:41.000Z', 'media_type': 'digital'}
Trakt: https://trakt.tv/shows/200222
Plex Rating: None
Trakt Rating: None
Watched on Plex: False
Plex play history:
[2023-11-17 06:47:03] ERROR    (500) internal_server_error;                                            
                               https://10-0-1-10.808cbc6741f14352b9c77bd45b676e74.plex.direct:32400/lib
                               rary/metadata/539544/children?excludeAllLeaves=1&index=None             
                               <html><head><title>Internal Server Error</title></head><body><h1>500    
                               Internal Server Error</h1></body></html>                                
                               ╭───────────────── Traceback (most recent call last) ──────────────────╮
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plextraktsync/cli.py:26 in wrap                          │
                               │                                                                      │
                               │    23 │   │   │   cmd = getattr(module, name)                        │
                               │    24 │   │   │                                                      │
                               │    25 │   │   │   try:                                               │
                               │ ❱  26 │   │   │   │   cmd(*args, **kwargs)                           │
                               │    27 │   │   │   except ClickException as e:                        │
                               │    28 │   │   │   │   from plextraktsync.factory import logger       │
                               │    29 │   │   │   │   logger.fatal(f"Error running {name} command: { │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plextraktsync/commands/inspect.py:105 in inspect         │
                               │                                                                      │
                               │   102 │   print(f"PlexTraktSync [{factory.version.full_version}]")   │
                               │   103 │                                                              │
                               │   104 │   for id in expand_id(inputs):                               │
                               │ ❱ 105 │   │   inspect_media(id)                                      │
                               │   106                                                                │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plextraktsync/commands/inspect.py:97 in inspect_media    │
                               │                                                                      │
                               │    94 │   │   │   dn = h.device.clientIdentifier                     │
                               │    95 │   │   else:                                                  │
                               │    96 │   │   │   dn = f"{d.name} with {d.platform}"                 │
                               │ ❱  97 │   │   print(f"- {h.viewedAt} {h}: by {h.account.name} on {dn │
                               │    98                                                                │
                               │    99                                                                │
                               │   100 def inspect(inputs: list[str]):                                │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/video.py:975 in __repr__                         │
                               │                                                                      │
                               │    972 │   │   │   ':'.join([p for p in [                            │
                               │    973 │   │   │   │   self.__class__.__name__,                      │
                               │    974 │   │   │   │   self.key.replace('/library/metadata/', '').re │
                               │ ❱  975 │   │   │   │   f"{self.grandparentTitle.replace(' ', '-')[:2 │
                               │    976 │   │   │   ] if p])                                          │
                               │    977 │   │   )                                                     │
                               │    978                                                               │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/base.py:516 in __getattribute__                  │
                               │                                                                      │
                               │   513 │                                                              │
                               │   514 │   def __getattribute__(self, attr):                          │
                               │   515 │   │   # Dragons inside.. :-/                                 │
                               │ ❱ 516 │   │   value = super(PlexPartialObject, self).__getattribute_ │
                               │   517 │   │   # Check a few cases where we don't want to reload      │
                               │   518 │   │   if attr in _DONT_RELOAD_FOR_KEYS: return value         │
                               │   519 │   │   if attr in USER_DONT_RELOAD_FOR_KEYS: return value     │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/video.py:1011 in seasonEpisode                   │
                               │                                                                      │
                               │   1008 │   @property                                                 │
                               │   1009 │   def seasonEpisode(self):                                  │
                               │   1010 │   │   """ Returns the s00e00 string containing the season a │
                               │ ❱ 1011 │   │   return f's{str(self.seasonNumber).zfill(2)}e{str(self │
                               │   1012 │                                                             │
                               │   1013 │   @property                                                 │
                               │   1014 │   def hasCommercialMarker(self):                            │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/base.py:516 in __getattribute__                  │
                               │                                                                      │
                               │   513 │                                                              │
                               │   514 │   def __getattribute__(self, attr):                          │
                               │   515 │   │   # Dragons inside.. :-/                                 │
                               │ ❱ 516 │   │   value = super(PlexPartialObject, self).__getattribute_ │
                               │   517 │   │   # Check a few cases where we don't want to reload      │
                               │   518 │   │   if attr in _DONT_RELOAD_FOR_KEYS: return value         │
                               │   519 │   │   if attr in USER_DONT_RELOAD_FOR_KEYS: return value     │
                               │                                                                      │
                               │ /usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Ver │
                               │ sions/3.10/lib/python3.10/functools.py:981 in __get__                │
                               │                                                                      │
                               │   978 │   │   │   │   # check if another thread filled cache while w │
                               │   979 │   │   │   │   val = cache.get(self.attrname, _NOT_FOUND)     │
                               │   980 │   │   │   │   if val is _NOT_FOUND:                          │
                               │ ❱ 981 │   │   │   │   │   val = self.func(instance)                  │
                               │   982 │   │   │   │   │   try:                                       │
                               │   983 │   │   │   │   │   │   cache[self.attrname] = val             │
                               │   984 │   │   │   │   │   except TypeError:                          │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/video.py:1006 in seasonNumber                    │
                               │                                                                      │
                               │   1003 │   @cached_property                                          │
                               │   1004 │   def seasonNumber(self):                                   │
                               │   1005 │   │   """ Returns the episode's season number. """          │
                               │ ❱ 1006 │   │   return self.parentIndex if isinstance(self.parentInde │
                               │        self._season.seasonNumber                                     │
                               │   1007 │                                                             │
                               │   1008 │   @property                                                 │
                               │   1009 │   def seasonEpisode(self):                                  │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/base.py:516 in __getattribute__                  │
                               │                                                                      │
                               │   513 │                                                              │
                               │   514 │   def __getattribute__(self, attr):                          │
                               │   515 │   │   # Dragons inside.. :-/                                 │
                               │ ❱ 516 │   │   value = super(PlexPartialObject, self).__getattribute_ │
                               │   517 │   │   # Check a few cases where we don't want to reload      │
                               │   518 │   │   if attr in _DONT_RELOAD_FOR_KEYS: return value         │
                               │   519 │   │   if attr in USER_DONT_RELOAD_FOR_KEYS: return value     │
                               │                                                                      │
                               │ /usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Ver │
                               │ sions/3.10/lib/python3.10/functools.py:981 in __get__                │
                               │                                                                      │
                               │   978 │   │   │   │   # check if another thread filled cache while w │
                               │   979 │   │   │   │   val = cache.get(self.attrname, _NOT_FOUND)     │
                               │   980 │   │   │   │   if val is _NOT_FOUND:                          │
                               │ ❱ 981 │   │   │   │   │   val = self.func(instance)                  │
                               │   982 │   │   │   │   │   try:                                       │
                               │   983 │   │   │   │   │   │   cache[self.attrname] = val             │
                               │   984 │   │   │   │   │   except TypeError:                          │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/video.py:966 in _season                          │
                               │                                                                      │
                               │    963 │   │   """ Returns the :class:`~plexapi.video.Season` object │
                               │        children. """                                                 │
                               │    964 │   │   if not self.grandparentKey:                           │
                               │    965 │   │   │   return None                                       │
                               │ ❱  966 │   │   return self.fetchItem(                                │
                               │    967 │   │   │                                                     │
                               │        f'{self.grandparentKey}/children?excludeAllLeaves=1&index={se │
                               │    968 │   │   )                                                     │
                               │    969                                                               │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/base.py:307 in fetchItem                         │
                               │                                                                      │
                               │   304 │   │   │   ekey = f'/library/metadata/{ekey}'                 │
                               │   305 │   │                                                          │
                               │   306 │   │   try:                                                   │
                               │ ❱ 307 │   │   │   return self.fetchItems(ekey, cls, **kwargs)[0]     │
                               │   308 │   │   except IndexError:                                     │
                               │   309 │   │   │   clsname = cls.__name__ if cls else 'None'          │
                               │   310 │   │   │   raise NotFound(f'Unable to find elem: cls={clsname │
                               │       None                                                           │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/base.py:255 in fetchItems                        │
                               │                                                                      │
                               │   252 │   │   │   headers['X-Plex-Container-Start'] = str(container_ │
                               │   253 │   │   │   headers['X-Plex-Container-Size'] = str(container_s │
                               │   254 │   │   │                                                      │
                               │ ❱ 255 │   │   │   data = self._server.query(ekey, headers=headers)   │
                               │   256 │   │   │   subresults = self.findItems(data, cls, ekey, **kwa │
                               │   257 │   │   │   total_size = utils.cast(int, data.attrib.get('tota │
                               │       data.attrib.get('size')) or len(subresults)                    │
                               │   258                                                                │
                               │                                                                      │
                               │ /Users/alpacalypse/.local/pipx/venvs/plextraktsync/lib/python3.10/si │
                               │ te-packages/plexapi/server.py:770 in query                           │
                               │                                                                      │
                               │    767 │   │   │   elif response.status_code == 404:                 │
                               │    768 │   │   │   │   raise NotFound(message)                       │
                               │    769 │   │   │   else:                                             │
                               │ ❱  770 │   │   │   │   raise BadRequest(message)                     │
                               │    771 │   │   data = response.text.encode('utf8')                   │
                               │    772 │   │   return ElementTree.fromstring(data) if data.strip() e │
                               │    773                                                               │
                               ╰──────────────────────────────────────────────────────────────────────╯
                               BadRequest: (500) internal_server_error;                                
                               https://10-0-1-10.808cbc6741f14352b9c77bd45b676e74.plex.direct:32400/lib
                               rary/metadata/539544/children?excludeAllLeaves=1&index=None             
                               <html><head><title>Internal Server Error</title></head><body><h1>500    
                               Internal Server Error</h1></body></html>                                
Error: Error running inspect command: (500) internal_server_error; https://10-0-1-10.808cbc6741f14352b9c77bd45b676e74.plex.direct:32400/library/metadata/539544/children?excludeAllLeaves=1&index=None <html><head><title>Internal Server Error</title></head><body><h1>500 Internal Server Error</h1></body></html>

@digitalgp edited your post.

it didn't bother you that you don't see what you posted?

I tried adding the exact file (\TV Shows\Watch What Happens Live with Andy Cohen (2009) {imdb-tt2057880}\Watch.What.Happens.Live.2023.10.12.720p.WEB.h264-EDITH.mp4) to my library and it has all proper metadata including a parentIndex.

Maybe try refreshing metadata for that show or doing the Plex dance for that show.

@digitalgp edited your post.

it didn't bother you that you don't see what you posted?

i tried to see if it was anything like token in it. but i guess i failed?

I tried adding the exact file (\TV Shows\Watch What Happens Live with Andy Cohen (2009) {imdb-tt2057880}\Watch.What.Happens.Live.2023.10.12.720p.WEB.h264-EDITH.mp4) to my library and it has all proper metadata including a parentIndex.

I tried the same and I can reproduce the bug.
The episode has no parentIndex and I get Plex 500 internal server error when running a sync.

<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="2" librarySectionTitle="Séries TV" librarySectionUUID="5f29efc2-be75-4eb6-a9e5-84a6fc0a1bce" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1698158239">
	<Video ratingKey="822" key="/library/metadata/822" skipParent="1" grandparentRatingKey="820" guid="local://822" parentGuid="local://821" grandparentGuid="plex://show/5d9f400906d220001fec16f5" type="episode" title="Épisode 10-12" titleSort="Episode 10" grandparentKey="/library/metadata/820" librarySectionTitle="Séries TV" librarySectionID="2" librarySectionKey="/library/sections/2" grandparentTitle="Watch What Happens: Live" originalTitle="Episode 10" contentRating="TV-14" summary="" year="2009" thumb="/library/metadata/822/thumb/1700303934" art="/library/metadata/820/art/1700303934" grandparentThumb="/library/metadata/820/thumb/1700303934" grandparentArt="/library/metadata/820/art/1700303934" duration="45199" originallyAvailableAt="2023-10-11" addedAt="1700146839" updatedAt="1700303934">
		<Media id="739" duration="45199" bitrate="3469" width="1280" height="720" aspectRatio="1.78" videoCodec="h264" videoResolution="720" container="mkv" videoFrameRate="NTSC" videoProfile="high">
			<Part accessible="1" exists="1" id="740" key="/library/parts/740/1556972868/file.mkv" duration="45199" file="/data/tvshows/Watch What Happens Live with Andy Cohen (2009) {imdb-tt2057880}/Watch.What.Happens.Live.2023.10.12.720p.WEB.h264-EDITH.mkv.mkv" size="19601818" container="mkv" videoProfile="high">
				<Stream id="3580" streamType="1" selected="1" default="1" codec="h264" index="0" bitrate="3469" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="720" codedWidth="1280" frameRate="30.000" hasScalingMatrix="0" height="720" level="32" profile="high" refFrames="4" scanType="progressive" width="1280" displayTitle="720p (H.264)" extendedDisplayTitle="720p (H.264)"></Stream>
			</Part>
		</Media>
		<Guid id="tmdb://3357756" />
		<Role id="13552" filter="actor=13552" tag="Carlos de Austria" tagKey="61a4e0011d88bcab935afeec" role="Beep" />
		<Role id="13553" filter="actor=13553" tag="Nazario Díaz" tagKey="61a4e0010c18d6cd6dbd67d4" role="" />
		<Role id="13554" filter="actor=13554" tag="Laura Perea" tagKey="61a4e0028365d8b7cbc5e149" role="" />
		<Role id="13555" filter="actor=13555" tag="Pablo Fernández" tagKey="5e9184613cd2be00404400bf" role="Alix" />
		<Role id="13556" filter="actor=13556" tag="Marta Belmonte" tagKey="5d7768ab33f255001e85c839" role="" thumb="https://metadata-static.plex.tv/c/people/c1166bca8e4114e2467ff47ded8aefbc.jpg" />
		<Role id="13557" filter="actor=13557" tag="Ken Appledorn" tagKey="5d7768b5374a5b001fece198" role="" thumb="https://metadata-static.plex.tv/people/5d7768b5374a5b001fece198.jpg" />
		<Extras size="0"></Extras>
		<Related></Related>
	</Video>
</MediaContainer>

PMS version : 1.32.7.7621

General PMS settings

Episode order : The Movie Database
Seasons : Hide when only 1 season

Watch What Happens: Live settings

Episode order : TheTVDB Absolute
Season : Hidden

When I run PlexTraktSync with plexapi 4.15.1 I get this output :

python -m plextraktsync sync --sync tv
INFO     PlexTraktSync [0.27.0dev0: 7e704e5f: Bump charset-normalizer from 3.3.1 to 3.3.2 (#1622) @2023-11-01 14:46:57]
INFO     Sync Show sections: ['Séries TV']
WARNING  Missing argument: title or season is required for plextraktsync.plex.PlexLibraryItem._get_episodes(), retrying
         after 1 seconds (try: 1/5)
WARNING  Missing argument: title or season is required for plextraktsync.plex.PlexLibraryItem._get_episodes(), retrying
         after 2 seconds (try: 2/5)
WARNING  Missing argument: title or season is required for plextraktsync.plex.PlexLibraryItem._get_episodes(), retrying
         after 3 seconds (try: 3/5)
WARNING  Missing argument: title or season is required for plextraktsync.plex.PlexLibraryItem._get_episodes(), retrying
         after 4 seconds (try: 4/5)
WARNING  Missing argument: title or season is required for plextraktsync.plex.PlexLibraryItem._get_episodes(), retrying
         after 5 seconds (try: 5/5)
ERROR    Error: Missing argument: title or season is required
ERROR    API didn't respond properly, script will abort now. Please try again later.
ERROR    Last call: plextraktsync.plex.PlexLibraryItem._get_episodes((), {})

General PMS settings

Episode order : The Movie Database Seasons : Hide when only 1 season

Watch What Happens: Live settings

Episode order : TheTVDB Absolute Season : Hidden

I tried all these settings and I still get the parentIndex.

But my PMS version is 1.32.8.7639.

image

<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="3" librarySectionTitle="TV Shows (Test)" librarySectionUUID="2172970e-90ec-4a05-ae7a-78c9555d245f" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1698884856">
<Video ratingKey="3229" key="/library/metadata/3229" skipParent="1" grandparentRatingKey="3227" guid="local://3229" parentGuid="local://3230" grandparentGuid="plex://show/5d9f400906d220001fec16f5" type="episode" title="Episode 167" grandparentKey="/library/metadata/3227" librarySectionTitle="TV Shows (Test)" librarySectionID="3" librarySectionKey="/library/sections/3" grandparentTitle="Watch What Happens Live with Andy Cohen" parentTitle="Season 20" contentRating="TV-14" summary="" index="167" parentIndex="20" thumb="/library/metadata/3229/thumb/1700353457" art="/library/metadata/3229/art/1700353457" grandparentThumb="/library/metadata/3227/thumb/1700353421" grandparentArt="/library/metadata/3227/art/1700353421" duration="300300" originallyAvailableAt="2023-10-12" addedAt="1700353419" updatedAt="1700353457">
<Media id="3813" duration="300300" bitrate="484" width="1920" height="1080" aspectRatio="1.78" audioChannels="2" audioCodec="aac" videoCodec="h264" videoResolution="1080" container="mp4" videoFrameRate="NTSC" optimizedForStreaming="1" audioProfile="lc" has64bitOffsets="0" videoProfile="main">
<Part accessible="1" exists="1" id="3847" key="/library/parts/3847/1596474017/file.mp4" duration="300300" file="******\TV Shows\Watch What Happens Live with Andy Cohen (2009) {imdb-tt2057880}\Watch.What.Happens.Live.2023.10.12.720p.WEB.h264-EDITH.mp4" size="18184197" audioProfile="lc" container="mp4" has64bitOffsets="0" optimizedForStreaming="1" videoProfile="main">
<Stream id="8494" streamType="1" default="1" codec="h264" index="0" bitrate="291" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="1088" codedWidth="1920" frameRate="30.000" hasScalingMatrix="0" height="1080" level="40" profile="main" refFrames="1" scanType="progressive" streamIdentifier="1" width="1920" displayTitle="1080p (H.264)" extendedDisplayTitle="1080p (H.264)"> </Stream>
<Stream id="8495" streamType="2" selected="1" default="1" codec="aac" index="1" channels="2" bitrate="188" audioChannelLayout="stereo" profile="lc" samplingRate="44100" streamIdentifier="2" displayTitle="Unknown (AAC Stereo)" extendedDisplayTitle="Unknown (AAC Stereo)"> </Stream>
</Part>
</Media>
<Guid id="tvdb://10071819"/>
<Extras size="0"> </Extras>
<Related> </Related>
</Video>
</MediaContainer>

PMS 1.32.8.7639 does have a fix for an API 500 error. Maybe that's fixed?

https://forums.plex.tv/t/adding-metadata-via-api-takes-way-too-long-with-recent-plex-server-versions/846957/72

I don't know why your parentIndex is missing, but I added a guard against it.

pkkid/python-plexapi#1304

The episode will show up as sNoneeNone.

I don't know why your parentIndex is missing, but I added a guard against it.

pkkid/python-plexapi#1304

The episode will show up as sNoneeNone.

Tested successfully with PMS 1.32.7.7621, thank you for your help.

WARNING <Episode:826:Watch-What-Happens:--sNoneeNone>: Skipping <PlexGuid:local://826> because provider local has no external Id

avoid the errors for now:

Fixed in plexapi 4.15.17

PR #1657 can be reversed after upgrading plexapi version.