Token refresh does not get picked up by watch mode container if it gets refreshed in sync mode container.
@simonc56 current problem with the latest release:
2025-09-20T12:19:43.406990490Z ERROR 400 - Unable to refresh expired OAuth token (invalid_grant) The 2025-09-20T12:19:43.407014540Z provided authorization grant is invalid, expired, revoked, does not 2025-09-20T12:19:43.407018730Z match the redirection URI used in the authorization request, or was 2025-09-20T12:19:43.407021832Z issued to another client. 2025-09-20T12:19:43.420209919Z ERROR Max token refresh attempts reached. Manual intervention required.as soon as I start watching something. It'll just constantly spits out the
Max token refresh attempts reached. Manual intervention required.and theUnauthorized - OAuth must be provideduntil I restart the container through either my auto restart on unhealthy or manually restarting it.I run both sync and watch. Watch, I have running 24/7 (which is where the problem arises) while sync, I have run every hour (doesn't have this problem since the container only starts up long enough to do a sync and then shuts down again until the next hour). It seems that if the sync ends up running the refresh for the token, then the watch container doesn't pick up the new token and ends up running into the above problem.
PlexTraktSync info:
PlexTraktSync Version: 0.34.15 Python Version: 3.13.7 (main, Aug 15 2025, 22:06:02) [GCC 14.2.0] Plex API Version: 4.17.1 Trakt API Version: 4.2.2
Originally posted by @JourneyOver in #1546
A workaround would be to restart the watch instance every 24h to let it pick the new refreshed token.
I'm kind of already doing this in a way now with a script and a healthcheck. The script grabs the last X lines of logs every 10 seconds and checks each lines timestamp against when the container started so it doesn’t get tripped up by old messages. If it finds certain keywords that indicate a problem (I'm using it for more than just this issue currently), it marks the PTS container as unhealthy. Then my autoheal container, which watches for unhealthy containers, steps in and restarts it automatically which then ofc makes the PTS watch instance pick up the new token that was issued from the sync instance.
This way works for me due to the fact that I run the sync instance every hour instead of a set time every day, so restarting just the watch instance every 24 hours wouldn't really work out for me.
It'd still be great though either way to actually have something built into PTS to automatically take care of picking up the new token from a multi-instance setup.