Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError in find_episodes #2113

Open
2 of 3 tasks
U1F984 opened this issue Dec 18, 2024 · 1 comment
Open
2 of 3 tasks

KeyError in find_episodes #2113

U1F984 opened this issue Dec 18, 2024 · 1 comment

Comments

@U1F984
Copy link

U1F984 commented Dec 18, 2024

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

Sync occasionally crashes with the error shown below.

Steps to reproduce the behavior

Running plextraktsync via docker-compose and just invoking sync

Error trace / logs

╭───────────────── Traceback (most recent call last) ─────────────────╮
│ /app/plextraktsync/cli.py:28 in wrap                                │
│                                                                     │
│    25 │   │   │   cmd = getattr(module, name)                       │
│    26 │   │   │                                                     │
│    27 │   │   │   try:                                              │
│ ❱  28 │   │   │   │   cmd(*args, **kwargs)                          │
│    29 │   │   │   except EOFError as e:                             │
│    30 │   │   │   │   raise ClickException(f"Program requested term │
│       connected: {e}")                                              │
│    31 │   │   │   except ClickException as e:                       │
│                                                                     │
│ /app/plextraktsync/commands/sync.py:74 in sync                      │
│                                                                     │
│   71 │   │   │   w.print_plan(print=logger.info)                    │
│   72 │   │   if dry_run:                                            │
│   73 │   │   │   logger.info("Enabled dry-run mode: not making actu │
│ ❱ 74 │   │   run_async(runner, walker=w, dry_run=config.dry_run)    │
│   75                                                                │
│                                                                     │
│ /usr/local/lib/python3.13/site-packages/decorator.py:232 in fun     │
│                                                                     │
│   229 │   │   def fun(*args, **kw):                                 │
│   230 │   │   │   if not kwsyntax:                                  │
│   231 │   │   │   │   args, kw = fix(args, kw, sig)                 │
│ ❱ 232 │   │   │   return caller(func, *(extras + args), **kw)       │
│   233 │   fun.__name__ = func.__name__                              │
│   234 │   fun.__doc__ = func.__doc__                                │
│   235 │   fun.__wrapped__ = func                                    │
│                                                                     │
│ /app/plextraktsync/decorators/coro.py:15 in coro                    │
│                                                                     │
│   12 │                                                              │
│   13 │   https://github.com/pallets/click/issues/85#issuecomment-50 │
│   14 │   """                                                        │
│ ❱ 15 │   return asyncio.run(f(*args, **kwargs))                     │
│   16                                                                │
│                                                                     │
│ /usr/local/lib/python3.13/asyncio/runners.py:194 in run             │
│                                                                     │
│   191 │   │   │   "asyncio.run() cannot be called from a running ev │
│   192 │                                                             │
│   193 │   with Runner(debug=debug, loop_factory=loop_factory) as ru │
│ ❱ 194 │   │   return runner.run(main)                               │
│   195                                                               │
│   196                                                               │
│   197 def _cancel_all_tasks(loop):                                  │
│                                                                     │
│ /usr/local/lib/python3.13/asyncio/runners.py:118 in run             │
│                                                                     │
│   115 │   │                                                         │
│   116 │   │   self._interrupt_count = 0                             │
│   117 │   │   try:                                                  │
│ ❱ 118 │   │   │   return self._loop.run_until_complete(task)        │
│   119 │   │   except exceptions.CancelledError:                     │
│   120 │   │   │   if self._interrupt_count > 0:                     │
│   121 │   │   │   │   uncancel = getattr(task, "uncancel", None)    │
│                                                                     │
│ /usr/local/lib/python3.13/asyncio/base_events.py:721 in             │
│ run_until_complete                                                  │
│                                                                     │
│    718 │   │   if not future.done():                                │
│    719 │   │   │   raise RuntimeError('Event loop stopped before Fu │
│    720 │   │                                                        │
│ ❱  721 │   │   return future.result()                               │
│    722 │                                                            │
│    723 │   def stop(self):                                          │
│    724 │   │   """Stop running the event loop.                      │
│                                                                     │
│ /app/plextraktsync/commands/sync.py:13 in run_async                 │
│                                                                     │
│   10                                                                │
│   11 @coro                                                          │
│   12 async def run_async(runner, **kwargs):                         │
│ ❱ 13 │   await runner.sync(**kwargs)                                │
│   14                                                                │
│   15                                                                │
│   16 def sync(                                                      │
│                                                                     │
│ /app/plextraktsync/sync/Sync.py:52 in sync                          │
│                                                                     │
│   49 │   │   │   async for movie in walker.find_movies():           │
│   50 │   │   │   │   await pm.ahook.walk_movie(movie=movie, dry_run │
│   51 │   │   │                                                      │
│ ❱ 52 │   │   │   async for episode in walker.find_episodes():       │
│   53 │   │   │   │   await pm.ahook.walk_episode(episode=episode, d │
│   54 │   │                                                          │
│   55 │   │   await pm.ahook.fini(walker=walker, dry_run=dry_run)    │
│                                                                     │
│ /app/plextraktsync/plan/Walker.py:136 in find_episodes              │
│                                                                     │
│   133 │   │                                                         │
│   134 │   │   async for ep in self.episodes_from_sections(self.plan │
│   135 │   │   │   show_id = ep.show_id                              │
│ ❱ 136 │   │   │   ep.show = plex_shows[show_id]                     │
│   137 │   │   │   show = show_cache.get(show_id)                    │
│   138 │   │   │   m = self.mf.resolve_any(ep, show)                 │
│   139 │   │   │   if not m:                                         │
╰─────────────────────────────────────────────────────────────────────╯
KeyError: 568765

Expected behavior

The sync goes through successfully

Inspect of problematic items

No response

Workarounds

No response

Config file contents

cache:
  path: /app/config/trakt_cache
excluded-libraries:
- Private
- Family Holidays
config:
  dotenv_override: true
plex:
  timeout: 30
logging:
  append: true
  console_time: false
  debug: false
  filename: plextraktsync.log
  filter_loggers: null
  filter: null
sync:
  rating_priority: plex
  plex_to_trakt:
    collection: true
    clear_collected: false
    ratings: true
    watched_status: true
    watchlist: true
  trakt_to_plex:
    liked_lists: true
    ratings: true
    watched_status: true
    watchlist: true
    watchlist_as_playlist: false
    playback_status: false
liked_lists:
  keep_watched: true
watch:
  add_collection: false
  remove_collection: false
  scrobble_threshold: 80
  username_filter: true
  media_progressbar: true
  ignore_clients: null
xbmc-providers:
  movies: imdb
  shows: tvdb

Install method

docker-compose

Version

0.32.2

Python Version

3.13.0

Plex Server Version

1.41.3.9314

Operating System and Version

Linux-6.8.8-3-pve-x86_64-with

@glensc
Copy link
Collaborator

glensc commented Dec 20, 2024

Re-scan plex show with id 568765 maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants