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

Sync stopped working: Not Found - method exists, but no record found #1864

Closed
3 tasks done
Prince25 opened this issue Mar 16, 2024 · 13 comments · Fixed by #1878
Closed
3 tasks done

Sync stopped working: Not Found - method exists, but no record found #1864

Prince25 opened this issue Mar 16, 2024 · 13 comments · Fixed by #1878

Comments

@Prince25
Copy link

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

PlexTraktSync stopped working around the beginning of February. I've used PlexTraktSync for years without any issues until now. I thought it would fix itself but it hasn't. I've looked at similar issues but found no solutions. I've scoured the README and looked at the troubleshooting section and the discussions but to no avail.

I've tried deleting the docker image and everything in the config folder including the cache to start fresh but nothing worked.

I noticed something interesting, though, during the setup phase when starting over. Just after logging into Trakt, it gives the following error:

RuntimeError: Server with name ThePriniaCloud is not defined

The entire chunk of this error is here if you want to take a look. Running the sync command again goes straight to syncing where I'm encountering the main error.

Steps to reproduce the behavior

run plextraktsync sync.

Error trace / logs

2024-03-15 20:00:45,027 INFO[plextraktsync.commands.sync]:PlexTraktSync [0.29.7]
2024-03-15 20:00:45,260 INFO[plextraktsync.plex.PlexServerConnection]:Connecting with url: https://192-168-0-106.9bb27997095140de8e90afb739109ad7.plex.direct:32400, timeout 60 seconds
2024-03-15 20:00:45,541 INFO[plextraktsync.commands.sync]:Sync Movie sections: ['Movies']
2024-03-15 20:00:45,543 INFO[plextraktsync.commands.sync]:Sync Show sections: ['Shows']
2024-03-15 20:00:50,328 ERROR[plextraktsync.cli]:Not Found - method exists, but no record found
Traceback (most recent call last):
  File "/app/plextraktsync/cli.py", line 26, in wrap
    cmd(*args, **kwargs)
  File "/app/plextraktsync/commands/sync.py", line 70, in sync
    runner.sync(walker=w, dry_run=config.dry_run)
  File "/app/plextraktsync/sync/Sync.py", line 71, in sync
    trakt_lists.add_to_lists(movie)
  File "/app/plextraktsync/trakt/TraktUserListCollection.py", line 23, in add_to_lists
    tl.add(m)
  File "/app/plextraktsync/trakt/TraktUserList.py", line 82, in add
    rank = self.items.get((m.media_type, m.trakt_id))
           ^^^^^^^^^^
  File "/app/plextraktsync/trakt/TraktUserList.py", line 46, in items
    self.description, self._items = self.load_items()
                                    ^^^^^^^^^^^^^^^^^
  File "/app/plextraktsync/trakt/TraktUserList.py", line 54, in load_items
    pl = PublicList.load(self.trakt_id)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/trakt/core.py", line 579, in inner
    json_data = self._handle_request('get', url)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/trakt/core.py", line 551, in _handle_request
    raise self.error_map[response.status_code](response)
trakt.errors.NotFoundException: Not Found - method exists, but no record found

Expected behavior

Sync like it has always been syncing.

Inspect of problematic items

No response

Workarounds

Tried 0.28.12 since it was published ~2 months ago. Same issue.
Couldn't try 0.27.11 or 0.27.0 because of

ConnectionError: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /oauth/device/code
         (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fcf0991b200>: Failed to resolve
         'api-v2launch.trakt.tv' ([Errno -2] Name does not resolve)"))
Error: Error running sync command: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /oauth/device/code (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fcf0991b200>: Failed to resolve 'api-v2launch.trakt.tv' ([Errno -2] Name does not resolve)"))

during Trakt log in.

Config file contents

cache:
  path: /app/config/trakt_cache
excluded-libraries:
- Music
- Extras
- Random
config:
  dotenv_override: true
plex:
  timeout: 60
logging:
  append: false
  console_time: false
  debug: false
  filename: plextraktsync.log
  filter_loggers: null
  filter: null
sync:
  rating_priority: trakt
  plex_to_trakt:
    collection: false
    clear_collected: true
    ratings: false
    watched_status: false
    watchlist: false
  trakt_to_plex:
    liked_lists: true
    ratings: true
    watched_status: true
    watchlist: true
    watchlist_as_playlist: false
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.29.7

Python Version

3.12.2

Plex Server Version

1.40.1.8227

Operating System and Version

Linux-4.4.302+-x86_64-with

@glensc
Copy link
Collaborator

glensc commented Mar 16, 2024

  1. one bug report a time
  2. the problem seems to be liked_lists related

for workaround disable liked lists feature. but try to figure out which liked list gives you this error. enable debug log and see last trakt api request.

@Prince25
Copy link
Author

I wasn't sure if the two issues were related so I thought I'd mention it. The server not defined error is not a big issue since it doesn't seem to affect anything.

You were right! It was one of the liked lists. I disabled liked_lists and it synced fine. I enabled debug and this was the last Trakt API request:

DEBUG[trakt.core]:get: https://api.trakt.tv/lists/26267601
DEBUG[trakt.core]:method, url :: get, https://api.trakt.tv/lists/26267601
DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
DEBUG[requests_cache.policy.actions]:Pre-read cache checks: Passed
DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1, send_request=True)
DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "GET /lists/26267601 HTTP/1.1" 404 None
DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(no_store=True)
DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled status, disabled by headers
DEBUG[requests_cache.session]:Skipping cache write for URL: https://api.trakt.tv/lists/26267601
DEBUG[trakt.core]:RESPONSE [get] (https://api.trakt.tv/lists/26267601): <Response [404]>
ERROR[plextraktsync.cli]:Not Found - method exists, but no record found

I went to https://trakt.tv/lists/26267601 and it redirected to one of my private lists that I "liked". Could it being private be the issue? The weird thing is that this list used to sync in the past. It exists in my Plex playlist. The list currently only has movies.

@Prince25
Copy link
Author

Prince25 commented Mar 19, 2024

I ran a bit more tests.
I enabled liked_lists and changed the privacy of the list in question from "Private" to "Public" and it worked!
I changed the privacy from "Public" to "Link" and it still worked.
I changed it to "Private" and it still worked?
I added 2 new items to the list but the log still showed 10 items in that list.

INFO     Downloaded Trakt list 'Next on Deck' (10 items):                       
         https://trakt.tv/lists/26267601   

I deleted the cache. It still showed 10 items on the list (all movies) and continued to work.
I am now confused.

@glensc
Copy link
Collaborator

glensc commented Mar 19, 2024

cache can be cloudflare side. try requesting the URL with trakt-api.sh helper:


➜ ./trakt-api.sh -i https://api.trakt.tv/lists/26267601
HTTP/2 200 
date: Tue, 19 Mar 2024 11:22:00 GMT
content-type: application/json; charset=utf-8
x-frame-options: SAMEORIGIN
x-xss-protection: 0
x-content-type-options: nosniff
x-download-options: noopen
x-permitted-cross-domain-policies: none
referrer-policy: strict-origin-when-cross-origin
expires: Tue, 19 Mar 2024 19:20:20 GMT
x-sort-by: rank
x-sort-how: asc
x-list-id: 26267601
etag: W/"e20a8ee4699cb813f08e99bf9111937c"
last-modified: Tue, 19 Mar 2024 01:02:32 GMT
cache-control: public, max-age=28800
vary: Accept-Encoding
x-ratelimit: {"name":"AUTHED_API_GET_LIMIT","period":300,"limit":1000,"remaining":999,"until":"2024-03-19T11:25:00Z"}
x-request-id: 790ccc11-f7f5-49d7-8165-f97626d3bb87
x-runtime: 0.034232
cf-cache-status: HIT
age: 100
server: cloudflare
cf-ray: 866d15097a78d91e-HEL
alt-svc: h3=":443"; ma=86400

more specifically:

cf-cache-status: HIT
age: 100

but. first check what's stored in your cache:

➜ plextraktsync cache https://api.trakt.tv/lists/26267601    

@Prince25
Copy link
Author

Prince25 commented Mar 22, 2024

Must have been the Cloudflare cache since I was sick for a few days and the log, as well as Plex, now correctly reflects 12 items (the list was public during this time).

I added 2 more items to my list and made it private. I deleted the local cache and ran plextraktsync sync and it resulted in the original error. Tried setting the list to "Link" and "Friends" as well, same error. I set it back to "Public" and it worked. I guess this confirms it can only sync "Public" liked lists. I suppose the only private lists one can like are their own. But I thought since plextraktsync uses the API, it would have access to private lists.

@glensc
Copy link
Collaborator

glensc commented Mar 22, 2024

Test how the curl request responds: trakt-api.sh. it sends api token headers, so, could it be that that endpoint doesn't serve private lists?

@Prince25
Copy link
Author

Ran into the Cloudflare cache issue again so got to wait for it to expire. Here's the output for your information.

HTTP/2 200
date: Sat, 23 Mar 2024 04:00:07 GMT
content-type: application/json; charset=utf-8
x-frame-options: SAMEORIGIN
x-xss-protection: 0
x-content-type-options: nosniff
x-download-options: noopen
x-permitted-cross-domain-policies: none
referrer-policy: strict-origin-when-cross-origin
expires: Sat, 23 Mar 2024 11:57:28 GMT
x-sort-by: rank
x-sort-how: asc
x-list-id: 26267601
etag: W/"374d480aafff0a9ac9e692c9cf65267e"
last-modified: Fri, 22 Mar 2024 00:01:47 GMT
cache-control: public, max-age=28800
vary: Accept-Encoding
x-ratelimit: {"name":"AUTHED_API_GET_LIMIT","period":300,"limit":1000,"remaining":999,"until":"2024-03-23T04:00:00Z"}
x-request-id: ae30931d-e4c2-4eef-b8f4-f77fc49ee8d4
x-runtime: 0.032278
cf-cache-status: HIT
age: 159
server: cloudflare
cf-ray: 868b8340f8f7cff9-SJC
alt-svc: h3=":443"; ma=86400

@glensc
Copy link
Collaborator

glensc commented Mar 23, 2024

what is the information? what is that request? and it has no body? please full details what did you test.

@Prince25
Copy link
Author

Prince25 commented Mar 24, 2024

Sorry for not being clear. The list was public last time so the body was the normal message you'd expect from the API. I set it to private but the Cloudflare cache hadn't yet updated so I had to wait for that. I posted the curl header output so that you could see it, as you had mentioned it earlier.

Anyway, now that the list is private and Cloudflare cache is updated, I get the following output when I run ./trakt-api.sh -i https://api.trakt.tv/lists/26267601.

HTTP/2 404
date: Sun, 24 Mar 2024 23:26:25 GMT
content-type: text/html
x-frame-options: SAMEORIGIN
x-xss-protection: 0
x-content-type-options: nosniff
x-download-options: noopen
x-permitted-cross-domain-policies: none
referrer-policy: strict-origin-when-cross-origin
cache-control: private, no-store
vary: Accept-Encoding
x-ratelimit: {"name":"AUTHED_API_GET_LIMIT","period":300,"limit":1000,"remaining":999,"until":"2024-03-24T23:30:00Z"}
x-request-id: 0889874f-9dbc-411a-ac75-1176332150a7
x-runtime: 0.072047
cf-cache-status: BYPASS
server: cloudflare
cf-ray: 869a6d123fd124fc-SJC
alt-svc: h3=":443"; ma=86400

curl: (22) The requested URL returned error: 404

You're correct in saying that it's not authorized to see private lists.

Edit: I don't think the status code is correct here. I get 403 in the browser. Just try going to https://api.trakt.tv/lists/26267601.

@glensc
Copy link
Collaborator

glensc commented Mar 25, 2024

seems the 403 response comes to 404 if you add trakt authorization headers (like the trakt-api script).

@glensc
Copy link
Collaborator

glensc commented Mar 25, 2024

did a few more tests:

user private lists are available from different endpoint, by slug or by id

  1. https://api.trakt.tv/users/glen666/lists/netflix/items
  2. https://api.trakt.tv/users/glen666/lists/20816319/items

with trakt token content is responded as well.

making the list public, the public URLs are still not accessible, not via api or web because my profile is private.

@glensc
Copy link
Collaborator

glensc commented Mar 25, 2024

and seems there are "type" and "privacy" fields that could be checked which endpoint to use

     "list": {
       "name": "Netflix",
       "description": "Items found from Netflix",
-      "privacy": "public",
+      "privacy": "private",
       "share_link": "https://trakt.tv/lists/20816319",
       "type": "personal",
./trakt-api.sh https://api.trakt.tv/users/likes/list | jq -C

so, in summary:

  1. if list is private and type personal, use personal list endpoint
  2. for public and official lists use public list api endpoint

glensc added a commit to glensc/PlexTraktSync that referenced this issue Mar 26, 2024
- Taxel#1864 (comment)

Do so until support is added
@glensc
Copy link
Collaborator

glensc commented Mar 26, 2024

Stopping the error:

Support for private lists is doable (see notes above), and can be requested via feature request issue if wanted.

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

Successfully merging a pull request may close this issue.

2 participants