trigg/Discover

Fails to open with KeyError: 'channels'

Closed this issue · 9 comments

rudha commented

Steps to Reproduce

Steps to reproduce the behavior:

$ .local/bin/discover-overlay -v
Traceback (most recent call last):
  File "/home/rudha/.local/lib/python3.11/site-packages/discover_overlay/discord_connector.py", line 755, in do_read
    self.on_message(msg)
  File "/home/rudha/.local/lib/python3.11/site-packages/discover_overlay/discord_connector.py", line 376, in on_message
    self.guilds[j['nonce']]["channels"] = j["data"]["channels"]
                                          ~~~~~~~~~^^^^^^^^^^^^
KeyError: 'channels'

Desktop (please complete the following information):

  • OS: Arch Linux, i3wm

Installation Method

  • AUR
  • python3 -m pip install discover-overlay

Additional context

After months of usage with no issues, this started happening right after python update 3.10 => 3.11, but it might be a coincidence as downgrading doesn't change the error. I also tried using the pip release instead of the AUR one but again, same error. I only use the voice channel functionality, and not the text one. I have also tried de-authorizing it from Discord with no success.

Discord info

Stable 201332 (10d1e45)
Host 0.0.27
Linux 64-Bit (6.3.4-Arch1-1)

trigg commented

Hello!
I see you turned on extra debugging but haven't attached it. It's stored in ~/.config/discover_overlay/output.txt

If you do send it feel free to redact 'ID is ...' for user ID and https://cdn.discordapp.com:443 "GET ... lines which show other user IDs.

rudha commented

Thanks for the reply! The first time I ran it produced this log:

INFO - discover_overlay.discover_overlay - Starting Discover Overlay: 0.6.5
ERROR - discover_overlay.image_getter - File not found: /home/rudha/.local/share/icons/hicolor/256x256/apps/discover-overlay-default.png
DEBUG - PIL.PngImagePlugin - STREAM b'IHDR' 16 13
DEBUG - PIL.PngImagePlugin - STREAM b'pHYs' 41 9
DEBUG - PIL.PngImagePlugin - STREAM b'tEXt' 62 25
DEBUG - PIL.PngImagePlugin - STREAM b'IDAT' 99 4965
ERROR - discover_overlay.image_getter - File not found: /home/rudha/.local/share/icons/hicolor/256x256/apps/discover-overlay-default.png
DEBUG - PIL.PngImagePlugin - STREAM b'IHDR' 16 13
DEBUG - PIL.PngImagePlugin - STREAM b'pHYs' 41 9
DEBUG - PIL.PngImagePlugin - STREAM b'tEXt' 62 25
DEBUG - PIL.PngImagePlugin - STREAM b'IDAT' 99 4965
DEBUG - urllib3.connectionpool - Starting new HTTPS connection (1): streamkit.discord.com:443
DEBUG - urllib3.connectionpool - https://streamkit.discord.com:443 "POST /overlay/token HTTP/1.1" 200 None
INFO - discover_overlay.discord_connector - ID is <ID>
INFO - discover_overlay.discord_connector - Logged in as rudha
DEBUG - urllib3.connectionpool - Starting new HTTPS connection (1): cdn.discordapp.com:443
DEBUG - urllib3.connectionpool - https://cdn.discordapp.com:443 "GET /icons/<ID>/<ID>.webp?size=128 HTTP/1.1" 200 3410
DEBUG - PIL.Image - Importing BlpImagePlugin
DEBUG - PIL.Image - Importing BmpImagePlugin
DEBUG - PIL.Image - Importing BufrStubImagePlugin
DEBUG - PIL.Image - Importing CurImagePlugin
DEBUG - PIL.Image - Importing DcxImagePlugin
DEBUG - PIL.Image - Importing DdsImagePlugin
DEBUG - PIL.Image - Importing EpsImagePlugin
DEBUG - PIL.Image - Importing FitsImagePlugin
DEBUG - PIL.Image - Importing FitsStubImagePlugin
DEBUG - PIL.Image - Importing FliImagePlugin
DEBUG - PIL.Image - Importing FpxImagePlugin
DEBUG - PIL.Image - Image: failed to import FpxImagePlugin: No module named 'olefile'
DEBUG - PIL.Image - Importing FtexImagePlugin
DEBUG - PIL.Image - Importing GbrImagePlugin
DEBUG - PIL.Image - Importing GifImagePlugin
DEBUG - PIL.Image - Importing GribStubImagePlugin
DEBUG - PIL.Image - Importing Hdf5StubImagePlugin
DEBUG - PIL.Image - Importing IcnsImagePlugin
DEBUG - PIL.Image - Importing IcoImagePlugin
DEBUG - PIL.Image - Importing ImImagePlugin
DEBUG - PIL.Image - Importing ImtImagePlugin
DEBUG - PIL.Image - Importing IptcImagePlugin
DEBUG - PIL.Image - Importing JpegImagePlugin
DEBUG - PIL.Image - Importing Jpeg2KImagePlugin
DEBUG - PIL.Image - Importing McIdasImagePlugin
DEBUG - PIL.Image - Importing MicImagePlugin
DEBUG - PIL.Image - Image: failed to import MicImagePlugin: No module named 'olefile'
DEBUG - PIL.Image - Importing MpegImagePlugin
DEBUG - PIL.Image - Importing MpoImagePlugin
DEBUG - PIL.Image - Importing MspImagePlugin
DEBUG - PIL.Image - Importing PalmImagePlugin
DEBUG - PIL.Image - Importing PcdImagePlugin
DEBUG - PIL.Image - Importing PcxImagePlugin
DEBUG - PIL.Image - Importing PdfImagePlugin
DEBUG - PIL.Image - Importing PixarImagePlugin
DEBUG - PIL.Image - Importing PngImagePlugin
DEBUG - PIL.Image - Importing PpmImagePlugin
DEBUG - PIL.Image - Importing PsdImagePlugin
DEBUG - PIL.Image - Importing QoiImagePlugin
DEBUG - PIL.Image - Importing SgiImagePlugin
DEBUG - PIL.Image - Importing SpiderImagePlugin
DEBUG - PIL.Image - Importing SunImagePlugin
DEBUG - PIL.Image - Importing TgaImagePlugin
DEBUG - PIL.Image - Importing TiffImagePlugin
DEBUG - PIL.Image - Importing WebPImagePlugin
DEBUG - PIL.Image - Importing WmfImagePlugin
DEBUG - PIL.Image - Importing XbmImagePlugin
DEBUG - PIL.Image - Importing XpmImagePlugin
DEBUG - PIL.Image - Importing XVThumbImagePlugin

Not sure why that png disappeared (or was never there) but replacing it with a random png produced this instead:

INFO - discover_overlay.discover_overlay - Starting Discover Overlay: 0.6.5
DEBUG - PIL.PngImagePlugin - STREAM b'IHDR' 16 13
DEBUG - PIL.PngImagePlugin - STREAM b'IDAT' 41 4096
DEBUG - PIL.PngImagePlugin - STREAM b'IHDR' 16 13
DEBUG - PIL.PngImagePlugin - STREAM b'IDAT' 41 4096
DEBUG - urllib3.connectionpool - Starting new HTTPS connection (1): streamkit.discord.com:443
DEBUG - urllib3.connectionpool - https://streamkit.discord.com:443 "POST /overlay/token HTTP/1.1" 200 None
INFO - discover_overlay.discord_connector - ID is <ID>
INFO - discover_overlay.discord_connector - Logged in as rudha
DEBUG - urllib3.connectionpool - Starting new HTTPS connection (1): cdn.discordapp.com:443
DEBUG - urllib3.connectionpool - https://cdn.discordapp.com:443 "GET /icons/<ID>/<ID>.webp?size=128 HTTP/1.1" 200 3410
DEBUG - PIL.Image - Importing BlpImagePlugin
DEBUG - PIL.Image - Importing BmpImagePlugin
DEBUG - PIL.Image - Importing BufrStubImagePlugin
DEBUG - PIL.Image - Importing CurImagePlugin
DEBUG - PIL.Image - Importing DcxImagePlugin
DEBUG - PIL.Image - Importing DdsImagePlugin
DEBUG - PIL.Image - Importing EpsImagePlugin
DEBUG - PIL.Image - Importing FitsImagePlugin
DEBUG - PIL.Image - Importing FitsStubImagePlugin
DEBUG - PIL.Image - Importing FliImagePlugin
DEBUG - PIL.Image - Importing FpxImagePlugin
DEBUG - PIL.Image - Image: failed to import FpxImagePlugin: No module named 'olefile'
DEBUG - PIL.Image - Importing FtexImagePlugin
DEBUG - PIL.Image - Importing GbrImagePlugin
DEBUG - PIL.Image - Importing GifImagePlugin
DEBUG - PIL.Image - Importing GribStubImagePlugin
DEBUG - PIL.Image - Importing Hdf5StubImagePlugin
DEBUG - PIL.Image - Importing IcnsImagePlugin
DEBUG - PIL.Image - Importing IcoImagePlugin
DEBUG - PIL.Image - Importing ImImagePlugin
DEBUG - PIL.Image - Importing ImtImagePlugin
DEBUG - PIL.Image - Importing IptcImagePlugin
DEBUG - PIL.Image - Importing JpegImagePlugin
DEBUG - PIL.Image - Importing Jpeg2KImagePlugin
DEBUG - PIL.Image - Importing McIdasImagePlugin
DEBUG - PIL.Image - Importing MicImagePlugin
DEBUG - PIL.Image - Image: failed to import MicImagePlugin: No module named 'olefile'
DEBUG - PIL.Image - Importing MpegImagePlugin
DEBUG - PIL.Image - Importing MpoImagePlugin
DEBUG - PIL.Image - Importing MspImagePlugin
DEBUG - PIL.Image - Importing PalmImagePlugin
DEBUG - PIL.Image - Importing PcdImagePlugin
DEBUG - PIL.Image - Importing PcxImagePlugin
DEBUG - PIL.Image - Importing PdfImagePlugin
DEBUG - PIL.Image - Importing PixarImagePlugin
DEBUG - PIL.Image - Importing PngImagePlugin
DEBUG - PIL.Image - Importing PpmImagePlugin
DEBUG - PIL.Image - Importing PsdImagePlugin
DEBUG - PIL.Image - Importing QoiImagePlugin
DEBUG - PIL.Image - Importing SgiImagePlugin
DEBUG - PIL.Image - Importing SpiderImagePlugin
DEBUG - PIL.Image - Importing SunImagePlugin
DEBUG - PIL.Image - Importing TgaImagePlugin
DEBUG - PIL.Image - Importing TiffImagePlugin
DEBUG - PIL.Image - Importing WebPImagePlugin
DEBUG - PIL.Image - Importing WmfImagePlugin
DEBUG - PIL.Image - Importing XbmImagePlugin
DEBUG - PIL.Image - Importing XpmImagePlugin
DEBUG - PIL.Image - Importing XVThumbImagePlugin

All with the same output on the console.

rudha commented

@trigg some updates on this: I tested another account on the discord canary client and it worked fine, I then tested that same account on the stable client and the overlay started with no issues, which leads me to believe the problem is somehow on my initial account as it also failed to work with the overlay while logged into the canary client.

trigg commented

Apologies on delay, I'm uncertain what exactly is causing this, but it very feasibly could be that you're in a server that has no channels at all, or it is sending an error reply that we're not properly checking for.

Depending on how confident you are, you could please add a new line as below, run it, and reply with the output from it?

In file /home/rudha/.local/lib/python3.11/site-packages/discover_overlay/discord_connector.py line 376.
Add this new line directly below the line starting with elif
print(j)

I don't know how well you know python, if you don't then be aware the spaces on the front need to match the line below.

The output will either contain a lot of IDs like {'cmd': 'GET_CHANNELS', 'data': {'channels': [{'id': '...', 'name': 'global', 'type': 0}, {'id': '... or will be an error message.

rudha commented

I got this line to print along with the lines from the first log:

{'cmd': 'GET_CHANNELS', 'data': {'code': 4003, 'message': 'Invalid guild id: <ID>'}, 'evt': 'ERROR', 'nonce': '<ID>'}

Let me know if you need the actual IDs.

rudha commented

For context that account has no DMs and is only attached to one server, which does have multiple text and voice channels.

trigg commented

I've pushed a slight alteration today to simply log it and attempt to continue. I'm unsure still what could be causing this to be shown as an invalid guild id

rudha commented

I pulled from latest master and it seems to be working now, puts out the error but just continues. Thanks for taking a look at it!

trigg commented

Thanks for reporting! Huge help getting all the things I don't find