PlexTraktSync: Error during Plex account access : Invalid token

Confirmation

  • I have read the README.md on the project homepage
  • I have checked if identical issue already exists

The problem

Hi Dev Team,

Since upgrading to the latest PlexTraktSync 0.21.1 I am getting the below error when trying to execute a sync. I have updated passwords due to Plex breach and have been working since. I have also tried re-authenticating with plex to get a new token

Error trace / logs

ERROR    Error during xxxxx account access: (422) unprocessable_entity; https://plex.tv/users/account <?xml version="1.0" encoding="UTF-8"?> <errors>   <error>Invalid token</error> </errors>
Sync Movie sections: [<PlexLibrarySection:movie:4K Movies>, <PlexLibrarySection:movie:Movies>]
Sync Show sections: [<PlexLibrarySection:show:TV Shows>]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/plextraktsync/__main__.py", line 18, in <module>
    cli()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/app/plextraktsync/cli.py", line 28, in wrap
    cmd(*args, **kwargs)
  File "/app/plextraktsync/commands/sync.py", line 60, in sync
    runner.sync(walker=w, dry_run=config.dry_run)
  File "/app/plextraktsync/sync.py", line 68, in sync
    self.plex_wl = {pm.guid: pm for pm in plex.watchlist()} or {}
TypeError: 'NoneType' object is not iterable

Expected behavior

Sync to start running

Steps to reproduce the behavior

docker exec -it plextraktsync plextraktsync sync --sync all

Inspect of problematic items

No response

Workarounds

Downgrade to version 0.20.10 for sync to work again

Install method

docker-compose

Version

0.21.1

Python Version

3.10.6

Operating System and Version

Ubuntu 22.04

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 28

Most upvoted comments

Yes, version 0.21.5 released now has the patch.

Ahh that did the trick.


/app # /root/.local/bin/plextraktsync@1038 sync --sync Movies
INFO     PlexTraktSync [0.21.0dev0]
Please enter your Plex username or e-mail: xxx
If you have 2 Factor Authentication enabled on Plex you can append the code to your password below (eg. passwordCODE)
Please enter your Plex password:
Login to MyPlex was successful!
- xxx: [Last seen: 2022-09-06 18:19:54, Server: Plex Media Server/1.28.2.6151-914ddd2b3 on PC: Linux/11 (bullseye)]
    https://plex.xxx.co.za:443
? Select default server: xxxx
Attempting to connect to xxx. This may take time and print some errors.
Server connections:
    https://plex.xxx.co.za:443
ERROR    http://plex.xxx.co.za:443: (400) bad_request; http://plex.xxxx.co.za:443/ <html> <head><title>400 The plain HTTP request was sent to HTTPS port</title></head> <body> <center><h1>400 Bad
         Request</h1></center> <center>The plain HTTP request was sent to HTTPS port</center> <hr><center>cloudflare</center> </body> </html>
Connection to xxxx established successfully!
Plex Media Server Authentication Token and base URL have been added to .env file
Sign in to Trakt
If you do not have a Trakt client ID and secret:
      1 - Open http://trakt.tv/oauth/applications on any computer
      2 - Login to your Trakt account
      3 - Press the NEW APPLICATION button
      4 - Set the NAME field = plex
      5 - Set the REDIRECT URL field = xxxxxx
      6 - Press the SAVE APP button

Please enter your client id: xxx
Please enter your client secret: xxx
Attempting to authenticate with Trakt
Your user code is: xxx, please navigate to https://trakt.tv/activate to authenticate
You've been successfully authenticated. With access_token xxxxxxxxxxx and refresh_token xxxxxxxxxxx
You are now logged into Trakt. Your Trakt credentials have been added in .env and .pytrakt.json files.
INFO     Sync Movie sections: [<PlexLibrarySection:movie:4K Movies>, <PlexLibrarySection:movie:Movies>]
Processing 4K Movies   6% ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/16  [ 0:00:02 < -:--:-- , ? it/s ]
INFO     4K Movies processed in 3.0 seconds
Processing Movies  99% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━ 1,881/1,904  [ 0:00:11 < 0:00:01 , 165 it/s ]
INFO     Movies processed in 12.1 seconds
Processing Plex watchlist   0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/0  [ 0:00:00 < -:--:-- , ? it/s ]
Processing Trakt watchlist   0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/0  [ 0:00:00 < -:--:-- , ? it/s ]
INFO     Updated watchlist in 0.0 seconds
INFO     Completed full sync in 27.9 seconds

.env

# This is .env file for PlexTraktSync
PLEX_BASEURL=https://plex.xxxx.co.za:443
PLEX_FALLBACKURL=
PLEX_LOCALURL=http://192.168.0.1:32400
PLEX_TOKEN=xxxxx
PLEX_OWNER_TOKEN=
PLEX_ACCOUNT_TOKEN=xxxxx
PLEX_USERNAME=xxx
TRAKT_USERNAME=xxx