Opened 8 months ago

Last modified 7 months ago

#3329 new bug

builtins.KeyError: 'label/label.js

Reported by: jools772 Owned by:
Priority: minor Milestone: 2.0.4
Component: Web UI Version: 2.0.3
Keywords: Cc:

Description (last modified by Cas)

web.Server Traceback (most recent call last):
builtins.KeyError: 'label/label.js'
/usr/lib/python3/dist-packages/twisted/web/server.py:199 in process
198                    self._encoder = encoder
199            self.render(resrc)
200        except:
/usr/lib/python3/dist-packages/twisted/web/server.py:259 in render
258        try:
259            body = resrc.render(self)
260        except UnsupportedMethod as e:
/usr/lib/python3/dist-packages/deluge/ui/web/server.py:629 in render
628
629        scripts = component.get('Scripts').get_scripts(script_type)
630        scripts.insert(0, 'gettext.js')
/usr/lib/python3/dist-packages/deluge/ui/web/server.py:371 in get_scripts
370            # A folder resource is enclosed in a tuple.
371            if isinstance(_scripts[path], tuple):
372                filepath, recurse = _scripts[path]
builtins.KeyError: 'label/label.js'

Change History (5)

comment:1 Changed 8 months ago by Cas

  • Description modified (diff)

Please provide more information as to how you encountered this issue

comment:2 Changed 8 months ago by jools772

It happens each time I open the web page for the web ui, after ther daemon has been running for some time. It happened now again, and it's resolved by restarting deluge-web.service. There is really no other context, except that you open the web ui page.

Logs: deliuge-web: https://pastebin.com/rCk9EaRH

The error log also appears on the web ui page when trying to load it.

comment:3 Changed 7 months ago by jools772

Here's the error written out since the pastebin expired:

web.Server Traceback (most recent call last):
builtins.KeyError: 'label/label.js'
/usr/lib/python3/dist-packages/twisted/web/server.py:199 in process
198                    self._encoder = encoder
199            self.render(resrc)
200        except:
/usr/lib/python3/dist-packages/twisted/web/server.py:259 in render
258        try:
259            body = resrc.render(self)
260        except UnsupportedMethod as e:
/usr/lib/python3/dist-packages/deluge/ui/web/server.py:629 in render
628
629        scripts = component.get('Scripts').get_scripts(script_type)
630        scripts.insert(0, 'gettext.js')
/usr/lib/python3/dist-packages/deluge/ui/web/server.py:371 in get_scripts
370            # A folder resource is enclosed in a tuple.
371            if isinstance(_scripts[path], tuple):
372                filepath, recurse = _scripts[path]
builtins.KeyError: 'label/label.js'

The error is pretty obvious: the path 'label/label.js' isn't found in the list '_scripts'. See here:

https://git.deluge-torrent.org/deluge/tree/deluge/ui/web/server.py#n371

The fix is to add one check:

if path in _scripts:

Would you please do this. I get the error quite frequently and it crashes the whole deluged daemon because of this.

Last edited 7 months ago by Cas (previous) (diff)

comment:4 Changed 7 months ago by jools772

The context is that one of the torrents is probably missing its label. I found out by looking at the count of torrents in filters window: http://prntscr.com/qhlqe2

The count of the totals didn't mwatch the number of unfiltered torrents, and I re-added labels to those all torrents manually.

It could be many things that lead to a missing label, but it would be good if the logs told us what happens instead of crashing. Maybe add that check and also log the name of the culprit in case there is a missing label. Could probably do this myself if I knew how to check out from trac.

comment:5 Changed 7 months ago by Cas

  • Milestone changed from needs verified to 2.0.4

Unfortunately I cannot replicate the issue however the problem you are reporting is a server script lookup issue, separate from actual torrents.

Looking at the code there should be no reason for order path value not be in the scripts dict but your error and forum users reporting it mean we will need to catch it, even if we don't understand it.

Note: See TracTickets for help on using tickets.