- 
                Notifications
    
You must be signed in to change notification settings  - Fork 72
 
Closed
Labels
bugSomething isn't workingSomething isn't workingfixed in devFixed in the development branchFixed in the development branch
Description
Describe the bug
When processing a webhook from Emby for shows like The Walking Dead (e.g., S02E03 or S02E04), the application crashes with a KeyError: 'tvdb_id'.
It appears that the method app.providers.tmdb.tv_with_seasons(...) does not always return a tvdb_id, but the code assumes its presence unconditionally.
Full traceback:
KeyError: 'tvdb_id'
File "/yamtrack/integrations/webhooks/base.py", line 65, in _process_tv
  tvdb_id = app.providers.tmdb.tv_with_seasons(media_id, [season_number])["tvdb_id"]
Steps to reproduce
- Connect Emby with the webhook endpoint 
/webhook/emby/... - Play an episode from a TV series that does not include 
tvdb_idin the TMDB response - The webhook triggers a 500 Internal Server Error
 - The log shows a KeyError related to the missing 
tvdb_id 
Expected behavior
The code should handle the case when tvdb_id is missing gracefully, avoiding a hard crash.
Environment
- Django: 5.2.2
 - Python: 3.12
 - Container: Custom Docker image (built from project Dockerfile)
 - DB: PostgreSQL 15
 
Thanks for the great work on Yamtrack 🙌 — this issue just needs a bit of defensive coding to improve webhook stability.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixed in devFixed in the development branchFixed in the development branch