PlexTraktSync: plex 500 internal error with index=None

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

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

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.

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: