Wavy-Bot / bot

The blazing-fast Discord bot.

Home Page:https://wavybot.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some Spotify playlists trigger "list index out of range" error

Wallvon opened this issue · comments

See title,

image

This seems to be happening when it tries to fetch an album image as you can see in the traceback below:

Traceback (most recent call last):

  File "/root/.local/share/virtualenvs/bot-5HK6sVgf/lib/python3.8/site-packages/discord/commands/core.py", line 110, in wrapped

    ret = await coro(arg)

  File "/root/.local/share/virtualenvs/bot-5HK6sVgf/lib/python3.8/site-packages/discord/commands/core.py", line 770, in _invoke

    await self.callback(self.cog, ctx, **kwargs)

  File "/opt/bot/wavy/cogs/music.py", line 325, in play

    spotify_query = await spotify.fetch(url=query)

  File "/opt/bot/wavy/utils/spotify.py", line 34, in fetch

    playlist = await fetch_playlist(parsed_url.id)

  File "/opt/bot/wavy/utils/spotify.py", line 168, in fetch_playlist

    image=track["album"]["images"][0]["url"],

IndexError: list index out of range


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "/root/.local/share/virtualenvs/bot-5HK6sVgf/lib/python3.8/site-packages/discord/client.py", line 352, in _run_event

    await coro(*args, **kwargs)

  File "/opt/bot/wavy/cogs/events.py", line 144, in on_application_command_error

    raise error

  File "/root/.local/share/virtualenvs/bot-5HK6sVgf/lib/python3.8/site-packages/discord/bot.py", line 768, in process_application_commands

    await ctx.command.invoke(ctx)

  File "/root/.local/share/virtualenvs/bot-5HK6sVgf/lib/python3.8/site-packages/discord/commands/core.py", line 306, in invoke

    await injected(ctx)

  File "/root/.local/share/virtualenvs/bot-5HK6sVgf/lib/python3.8/site-packages/discord/commands/core.py", line 116, in wrapped

    raise ApplicationCommandInvokeError(exc) from exc

discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: IndexError: list index out of range

whoops, meant to close this one