Skip to content

REST-client rewrite: sync aborts with KeyError: 'watched' (object contract not populated) #715

Description

@yitzhaq

Testing the trakt.py→REST-client rewrite on main (9385020), a manual sync aborts almost immediately in the movie sync, before shows/episodes are processed. Filing separately from #714 since it's unrelated to pagination.

Repro: deploy main with real keys + an existing OAuth token, trigger RunScript(script.trakt, action=sync).

Traceback

File "resources/lib/service.py", line 427, in run → sync.sync()
File "resources/lib/sync.py", line 69, in sync → syncMovies.SyncMovies(self, progress)
File "resources/lib/syncMovies.py", line 52, in __init__ → self.__addMoviesToTraktWatched(kodiMovies, traktMovies, 59, 69)
File "resources/lib/syncMovies.py", line 295, in __addMoviesToTraktWatched → utilities.compareMovies(...)
File "resources/lib/utilities.py", line 365, in compareMovies → if movie_col2["watched"] == 0 and movie_col1["watched"] == 1:
KeyError: 'watched'

Cause: the rewrite replaced trakt.py but left the sync consumers (syncMovies, syncEpisodes, utilities) unchanged. The old lib populated boolean flags on each object — watched (0/1), collected, and per-episode watched — which those consumers still read (compareMovies, compareEpisodes, etc.). The new _merge_object/_merge_show/TraktObject shim copies plays/last_watched_at/collected_at but doesn't set those flags, so the first comparison raises KeyError. This affects the whole return-shape contract between traktapi and the sync modules, not just the watched getters. Flagging early so it isn't mistaken for a pagination issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions