Deluge error on startup: Path segment must be bytes

Hello, I’m using the latest release of deluge container and on startup it’s giving me this error:

Traceback (most recent call last):
  File "/usr/bin/deluge-web", line 8, in <module>
    sys.exit(start())
  File "/usr/lib/python3.10/site-packages/deluge/ui/web/__init__.py", line 6, in start
    web.start()
  File "/usr/lib/python3.10/site-packages/deluge/ui/web/web.py", line 71, in start
    self.__server = server.DelugeWeb(options=self.options)
  File "/usr/lib/python3.10/site-packages/deluge/ui/web/server.py", line 685, in __init__
    self.top_level.putChild(self.base.strip('/'), self.top_level)
  File "/usr/lib/python3.10/site-packages/twisted/web/resource.py", line 234, in putChild
    raise TypeError(f"Path segment must be bytes, but {path!r} is {type(path)}")
TypeError: Path segment must be bytes, but 'deluge' is <class 'str'>

Docker-compose configuration:

  deluge:
      image: linuxserver/deluge
      container_name: deluge
      restart: unless-stopped
      networks:
          - web
      ports:
          - '8112:8112'
          - '8118:8118'
          - '58846:58846'
          - '58946:58946'
      cap_add:
          - NET_ADMIN
      environment:
          - TZ=${TZ}
          - PUID=${PUID}
          - PGID=${PGID}
      volumes:
          - '../media/downloads:/downloads'
          - './deluge/config:/config'
          - '/etc/localtime:/etc/localtime:ro'

web.conf:

{
    "file": 2,
    "format": 1
}{
    "base": "/deluge/",
    "cert": "ssl/daemon.cert",
    "default_daemon": "",
    "enabled_plugins": [],
    "first_login": false,
    "https": false,
    "interface": "0.0.0.0",
    "language": "",
    "pkey": "ssl/daemon.pkey",
    "port": 8112,
    "pwd_salt": "(redacted)",
    "pwd_sha1": "(redacted)",
    "session_timeout": 3600,
    "sessions": "(redacted)",
    "show_session_speed": false,
    "show_sidebar": true,
    "sidebar_multiple_filters": true,
    "sidebar_show_zero": false,
    "theme": "gray"
}

Any help would be appreciated.

1 Like

Looks to be an issue with the upstream Deluge project not sending the base path to Twisted as a bytes object. Twisted updated this on the 25th of Oct.
Needs to have a fix implemented (as described here: Fix serving from custom base path by mueslo · Pull Request #390 · deluge-torrent/deluge · GitHub)

In the meantime, until Deluge fixes this try using the image version linuxserver/deluge:2.1.1-r3-ls179
This works for me