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

RuntimeError: Server with name 'SFlix' is not defined #2050

Closed
2 of 3 tasks
stevezau opened this issue Sep 8, 2024 · 2 comments · Fixed by #2052
Closed
2 of 3 tasks

RuntimeError: Server with name 'SFlix' is not defined #2050

stevezau opened this issue Sep 8, 2024 · 2 comments · Fixed by #2052

Comments

@stevezau
Copy link

stevezau commented Sep 8, 2024

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

Hi, on an initial setup i am getting

         │ /app/plextraktsync/config/ServerConfigFactory.py:23 in get_server                                                                                                                                                                             │
         │                                                                                                                                                                                                                                               │
         │   20 │   │   try:                                                                                                                                                                                                                             │
         │   21 │   │   │   return PlexServerConfig(name=name, **self.servers[name])                                                                                                                                                                     │
         │   22 │   │   except KeyError:                                                                                                                                                                                                                 │
         │ ❱ 23 │   │   │   raise RuntimeError(f"Server with name '{name}' is not defined")                                                                                                                                                              │
         │   24 │                                                                                                                                                                                                                                        │
         │   25 │   def server_by_id(self, id: str):                                                                                                                                                                                                     │
         │   26 │   │   self.load()                                                                                                                                                                                                                      │
         ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
         RuntimeError: Server with name 'SFlix' is not defined

Steps to reproduce the behavior

Run via docker

docker run -it --rm -e PGID=1000 -e PUID=1000 -v /etc/localtime:/etc/localtime:ro -e TZ="Australia/Sydney"  --name=traktsync -v /config/traktsync:/app/config  ghcr.io/taxel/plextraktsync:latest sync

It prompts me for the Plex server credentials, the server, trakt cred's etc. After entering and auth trakt, that's when it spits out this error.

After it fails, i checked server.yml

servers:
  default:
    token: null
    urls:
    - null
    - null
    id: null
    config: null
  SFlix:
    token: xxxxxxxx
    urls:
    - https://xxxxxbc3bffffa82415.plex.direct:32400
    - http://xxx.xx.xx.xx:32400
    - https://xxx.xx.xx.xx.262280e6da5f4e50adbc3bffffa82415.plex.direct:32433
    - http://xx.xx.xx.xx:32433
    - http://xx.xx.xx:32400
    id: xxxxxxxxxxxx
    config: null

Error trace / logs

2024-09-09 09:25:56,769 INFO[plextraktsync.commands.sync]:PlexTraktSync [0.31.12]
2024-09-09 09:26:04,722 DEBUG[plexapi]:POST https://plex.tv/api/v2/users/signin
2024-09-09 09:26:04,728 DEBUG[urllib3.connectionpool]:Starting new HTTPS connection (1): plex.tv:443
2024-09-09 09:26:05,666 DEBUG[urllib3.connectionpool]:https://plex.tv:443 "POST /api/v2/users/signin HTTP/11" 201 None
2024-09-09 09:26:05,720 DEBUG[charset_normalizer]:Encoding detection: utf_8 is most likely the one.
2024-09-09 09:26:05,738 DEBUG[plexapi]:GET https://plex.tv/api/v2/resources?includeHttps=1&includeRelay=1
2024-09-09 09:26:06,045 DEBUG[urllib3.connectionpool]:https://plex.tv:443 "GET /api/v2/resources?includeHttps=1&includeRelay=1 HTTP/11" 200 None
2024-09-09 09:26:06,070 DEBUG[charset_normalizer]:Encoding detection: utf_8 is most likely the one.
2024-09-09 09:26:06,088 DEBUG[asyncio]:Using selector: EpollSelector
2024-09-09 09:26:07,453 DEBUG[plexapi]:GET https://plex.tv/api/v2/resources?includeHttps=1&includeRelay=1
2024-09-09 09:26:07,750 DEBUG[urllib3.connectionpool]:https://plex.tv:443 "GET /api/v2/resources?includeHttps=1&includeRelay=1 HTTP/11" 200 None
2024-09-09 09:26:07,784 DEBUG[charset_normalizer]:Encoding detection: utf_8 is most likely the one.
2024-09-09 09:26:07,792 DEBUG[plexapi]:Testing 6 resource connections..
2024-09-09 09:26:07,793 DEBUG[plexapi]:GET https://172-17-0-22.262280e6da5f4e50adbc3bffffa82415.plex.direct:32400/
2024-09-09 09:26:07,794 DEBUG[urllib3.connectionpool]:Starting new HTTPS connection (1): 172-17-0-22.262280e6da5f4e50adbc3bffffa82415.plex.direct:32400
2024-09-09 09:26:07,795 DEBUG[plexapi]:GET http://xx.xx.xx.xx:32400/
2024-09-09 09:26:07,796 DEBUG[plexapi]:GET https://xx.xx.xx.xx.262280e6da5f4e50adbc3bffffa82415.plex.direct:32433/
2024-09-09 09:26:07,797 DEBUG[urllib3.connectionpool]:Starting new HTTP connection (1): xx.xx.xx.xx:32400
2024-09-09 09:26:07,798 DEBUG[urllib3.connectionpool]:Starting new HTTPS connection (1): xx.xx.xx.xx.262280e6da5f4e50adbc3bffffa82415.plex.direct:32433
2024-09-09 09:26:07,800 DEBUG[plexapi]:GET http://87.121.73.66:32433/
2024-09-09 09:26:07,801 DEBUG[urllib3.connectionpool]:Starting new HTTP connection (1): 87.121.73.66:32433
2024-09-09 09:26:07,802 DEBUG[plexapi]:GET https://xx.xx.xx.xx262280e6da5f4e50adbc3bffffa82415.plex.direct:8443/
2024-09-09 09:26:07,804 DEBUG[urllib3.connectionpool]:Starting new HTTPS connection (1): xx.xx.xx.xx262280e6da5f4e50adbc3bffffa82415.plex.direct:8443
2024-09-09 09:26:07,804 DEBUG[plexapi]:GET http://xx.xx.xx.xx:8443/
2024-09-09 09:26:07,806 DEBUG[urllib3.connectionpool]:Starting new HTTP connection (1): xx.xx.xx.xx:8443
2024-09-09 09:26:07,807 DEBUG[urllib3.connectionpool]:http://xx.xx.xx.xx:32400 "GET / HTTP/11" 200 4643
2024-09-09 09:26:07,812 DEBUG[urllib3.connectionpool]:http://87.121.73.66:32433 "GET / HTTP/11" 200 4643
2024-09-09 09:26:07,995 ERROR[plexapi]:http://xx.xx.xx.xx:8443: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
2024-09-09 09:26:08,329 DEBUG[urllib3.connectionpool]:https://xx.xx.xx.xx.262280e6da5f4e50adbc3bffffa82415.plex.direct:32433 "GET / HTTP/11" 200 4643
2024-09-09 09:26:08,332 DEBUG[urllib3.connectionpool]:https://172-17-0-22.262280e6da5f4e50adbc3bffffa82415.plex.direct:32400 "GET / HTTP/11" 200 4643
2024-09-09 09:26:09,701 DEBUG[urllib3.connectionpool]:https://xx.xx.xx.xx262280e6da5f4e50adbc3bffffa82415.plex.direct:8443 "GET / HTTP/11" 200 4709
2024-09-09 09:26:09,710 DEBUG[plexapi]:Resource connection OK (0s): https://172-17-0-22.262280e6da5f4e50adbc3bffffa82415.plex.direct:32400?X-Plex-Token=<hidden>
2024-09-09 09:26:09,710 DEBUG[plexapi]:Resource connection OK (0s): http://xx.xx.xx.xx:32400?X-Plex-Token=<hidden>
2024-09-09 09:26:09,711 DEBUG[plexapi]:Resource connection OK (0s): https://xx.xx.xx.xx.262280e6da5f4e50adbc3bffffa82415.plex.direct:32433?X-Plex-Token=<hidden>
2024-09-09 09:26:09,711 DEBUG[plexapi]:Resource connection OK (0s): http://87.121.73.66:32433?X-Plex-Token=<hidden>
2024-09-09 09:26:09,711 DEBUG[plexapi]:Resource connection OK (1s): https://xx.xx.xx.xx262280e6da5f4e50adbc3bffffa82415.plex.direct:8443?X-Plex-Token=<hidden>
2024-09-09 09:26:09,711 DEBUG[plexapi]:Resource connection ERR (0s): http://xx.xx.xx.xx:8443?X-Plex-Token=<hidden>
2024-09-09 09:26:09,711 DEBUG[plexapi]:Connecting to Resource: https://172-17-0-22.262280e6da5f4e50adbc3bffffa82415.plex.direct:32400?X-Plex-Token=<hidden>
2024-09-09 09:26:09,712 DEBUG[plexapi]:GET https://plex.tv/api/users/
2024-09-09 09:26:10,224 DEBUG[urllib3.connectionpool]:https://plex.tv:443 "GET /api/users/ HTTP/11" 200 None
2024-09-09 09:26:10,406 DEBUG[requests_cache.backends]:Initializing backend: None /app/config/trakt_cache
2024-09-09 09:26:10,406 DEBUG[requests_cache.backends.base]:Initialized SQLiteDict with serializer: SerializerPipeline(name=pickle, n_stages=2)
2024-09-09 09:26:10,406 DEBUG[requests_cache.backends.sqlite]:Opening connection to /app/config/trakt_cache.sqlite:responses
2024-09-09 09:26:10,423 DEBUG[requests_cache.backends.base]:Initialized SQLiteDict with serializer: None
2024-09-09 09:26:10,423 DEBUG[requests_cache.backends.sqlite]:Opening connection to /app/config/trakt_cache.sqlite:redirects
2024-09-09 09:26:22,942 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-09-09 09:26:22,956 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled method
2024-09-09 09:26:22,956 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1, send_request=True, skip_read=True)
2024-09-09 09:26:22,956 DEBUG[urllib3.connectionpool]:Starting new HTTPS connection (1): api.trakt.tv:443
2024-09-09 09:26:23,261 DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "POST /oauth/device/code HTTP/11" 200 None
2024-09-09 09:26:23,263 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(max_age=0, must_revalidate=True, etag='W/"d593413529d23872e889998002ea7f36"')
2024-09-09 09:26:23,263 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled method
2024-09-09 09:26:23,263 DEBUG[requests_cache.session]:Skipping cache write for URL: https://api.trakt.tv/oauth/device/code
2024-09-09 09:26:23,266 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-09-09 09:26:23,267 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled method
2024-09-09 09:26:23,267 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1, send_request=True, skip_read=True)
2024-09-09 09:26:23,560 DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "POST /oauth/device/token HTTP/11" 400 None
2024-09-09 09:26:23,561 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(no_store=True)
2024-09-09 09:26:23,562 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled method, disabled status, disabled by headers
2024-09-09 09:26:23,562 DEBUG[requests_cache.session]:Skipping cache write for URL: https://api.trakt.tv/oauth/device/token
2024-09-09 09:26:28,564 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-09-09 09:26:28,565 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled method
2024-09-09 09:26:28,565 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1, send_request=True, skip_read=True)
2024-09-09 09:26:28,858 DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "POST /oauth/device/token HTTP/11" 400 None
2024-09-09 09:26:28,860 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(no_store=True)
2024-09-09 09:26:28,860 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled method, disabled status, disabled by headers
2024-09-09 09:26:28,860 DEBUG[requests_cache.session]:Skipping cache write for URL: https://api.trakt.tv/oauth/device/token
2024-09-09 09:26:33,863 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-09-09 09:26:33,864 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled method
2024-09-09 09:26:33,864 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1, send_request=True, skip_read=True)
2024-09-09 09:26:34,147 DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "POST /oauth/device/token HTTP/11" 400 None
2024-09-09 09:26:34,149 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(no_store=True)
2024-09-09 09:26:34,149 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled method, disabled status, disabled by headers
2024-09-09 09:26:34,149 DEBUG[requests_cache.session]:Skipping cache write for URL: https://api.trakt.tv/oauth/device/token
2024-09-09 09:26:39,151 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-09-09 09:26:39,151 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled method
2024-09-09 09:26:39,151 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1, send_request=True, skip_read=True)
2024-09-09 09:26:39,439 DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "POST /oauth/device/token HTTP/11" 200 None
2024-09-09 09:26:39,440 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(max_age=0, must_revalidate=True, etag='W/"af8f014b5a0218969904bf38b9d697d5"')
2024-09-09 09:26:39,441 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled method
2024-09-09 09:26:39,441 DEBUG[requests_cache.session]:Skipping cache write for URL: https://api.trakt.tv/oauth/device/token
2024-09-09 09:26:39,442 DEBUG[trakt.core]:get: https://api.trakt.tv/users/me
2024-09-09 09:26:39,442 DEBUG[trakt.core]:method, url :: get, https://api.trakt.tv/users/me
2024-09-09 09:26:39,444 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-09-09 09:26:39,445 DEBUG[requests_cache.policy.expiration]:URL https://api.trakt.tv/users/me matched pattern "api.trakt.tv/users/me": 3674576450094852
2024-09-09 09:26:39,445 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled by expiration
2024-09-09 09:26:39,445 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=3674576450094852, send_request=True, skip_read=True)
2024-09-09 09:26:39,740 DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "GET /users/me HTTP/11" 200 None
2024-09-09 09:26:39,741 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(max_age=0, must_revalidate=True, etag='W/"5201c75f3388f92792d6f08a9b61131f"')
2024-09-09 09:26:39,742 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: Passed
2024-09-09 09:26:39,763 DEBUG[trakt.core]:RESPONSE [get] (https://api.trakt.tv/users/me): <Response [200]>
2024-09-09 09:26:39,787 ERROR[plextraktsync.cli]:Server with name 'SFlix' is not defined
Traceback (most recent call last):
  File "/app/plextraktsync/config/ServerConfigFactory.py", line 21, in get_server
    return PlexServerConfig(name=name, **self.servers[name])
                                         ~~~~~~~~~~~~^^^^^^
KeyError: 'SFlix'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/plextraktsync/cli.py", line 28, in wrap
    cmd(*args, **kwargs)
  File "/app/plextraktsync/commands/sync.py", line 52, in sync
    w = factory.walker
        ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/functools.py", line 993, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/app/plextraktsync/util/Factory.py", line 191, in walker
    plex = self.plex_api
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/functools.py", line 993, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/app/plextraktsync/util/Factory.py", line 48, in plex_api
    server=self.plex_server,
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/functools.py", line 993, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/app/plextraktsync/util/Factory.py", line 83, in plex_server
    server = self.server_config
             ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/functools.py", line 993, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/app/plextraktsync/util/Factory.py", line 121, in server_config
    return server_config.get_server(server_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/plextraktsync/config/ServerConfigFactory.py", line 23, in get_server
    raise RuntimeError(f"Server with name '{name}' is not defined")
RuntimeError: Server with name 'SFlix' is not defined

Expected behavior

Expected it to not fail on the initial config.

Inspect of problematic items

No response

Workarounds

No response

Config file contents

No response

Install method

docker-compose

Version

0.31.12

Python Version

docker..

Plex Server Version

1.41.0.8930

Operating System and Version

Ubuntu 24.04.1

@stevezau
Copy link
Author

stevezau commented Sep 9, 2024

NOTE I got around this by manually setting up my configs.. but, i posted it here as it seems like a bug.

@glensc
Copy link
Collaborator

glensc commented Sep 9, 2024

This happens only on first run. No need to create configs manually. Just run again.

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