# Buggy code
async def _build_queue_page(
    self, ctx: commands.Context, player: lavalink.player_manager.Player, page_num
):
    shuffle = await self.config.guild(ctx.guild).shuffle()
    repeat = await self.config.guild(ctx.guild).repeat()
    autoplay = await self.config.guild(ctx.guild).auto_play() or self.owns_autoplay

    queue_num_pages = math.ceil(len(player.queue) / 10)
    queue_idx_start = (page_num - 1) * 10
    queue_idx_end = queue_idx_start + 10
    queue_list = ""
    try:
        arrow = await draw_time(ctx)
    except AttributeError:
        return await self._embed_msg(ctx, _("There's nothing in the queue."))
    pos = lavalink.utils.format_time(player.position)

    if player.current.is_stream:
        dur = "LIVE"
    else:
        dur = lavalink.utils.format_time(player.current.length)

    query = audio_dataclasses.Query.process_input(player.current)

    if query.is_stream:
        queue_list += _("**Currently livestreaming:**\n")
        queue_list += "**[{current.title}]({current.uri})**\n".format(
            current=player.current
        )
        queue_list += _("Requested by: **{user}**").format(
            user=player.current.requester
        )
        queue_list += f"\n\n{arrow}`{pos}`/`{dur}`\n\n"

    elif query.is_local:
        if player.current.title != "Unknown title":
            queue_list += "\n".join(
                (
                    _("Playing: ")
                    + "**{current.author} - {current.title}**".format(
                        current=player.current
                    ),
                    audio_dataclasses.LocalPath(player.current.uri).to_string_hidden(),
                    _("Requested by: **{user}**\n").format(
                        user=player.current.requester
                    ),
                    f"{arrow}`{pos}`/`{dur}`\n\n",
                )
            )
        else:
            queue_list += "\n".join(
                (
                    _("Playing: ")
                    + audio_dataclasses.LocalPath(
                        player.current.uri
                    ).to_string_hidden(),
                    _("Requested by: **{user}**\n").format(
                        user=player.current.requester
                    ),
                    f"{arrow}`{pos}`/`{dur}`\n\n",
                )
            )
    else:
        queue_list += _("Playing: ")
        queue_list += "**[{current.title}]({current.uri})**\n".format(
            current=player.current
        )
        queue_list += _("Requested by: **{user}**").format(
            user=player.current.requester
        )
        queue_list += f"\n\n{arrow}`{pos}`/`{dur}`\n\n"

    for i, track in enumerate(
        player.queue[queue_idx_start:queue_idx_end], start=queue_idx_start
    ):
        if len(track.title) > 40:
            track_title = str(track.title).replace("[", "")
            track_title = "{}...".format((track_title[:40]).rstrip(" "))
        else:
            track_title = track.title
        req_user = track.requester
        track_idx = i + 1
        query = audio_dataclasses.Query.process_input(track)

        if query.is_local:
            if track.title == "Unknown title":
                queue_list += f"`{track_idx}.` " + ", ".join(
                    (
                        bold(audio_dataclasses.LocalPath(track.uri).to_string_hidden()),
                        _("requested by **{user}**\n").format(user=req_user),
                    )
                )
            else:
                queue_list += (
                    f"`{track_idx}.` **{track.author} - {track_title}**, "
                    + _("requested by **{user}**\n").format(user=req_user)
                )
        else:
            queue_list += f"`{track_idx}.` **[{track_title}]({track.uri})**, "
            queue_list += _("requested by **{user}**\n").format(user=req_user)

    embed = discord.Embed(
        colour=await ctx.embed_colour(),
        title="Queue for " + ctx.guild.name,
        description=queue_list,
    )
    if await self.config.guild(ctx.guild).thumbnail() and player.current.thumbnail:
        embed.set_thumbnail(url=player.current.thumbnail)
    queue_dur = await queue_duration(ctx)
    queue_total_duration = lavalink.utils.format_time(queue_dur)
    text = _(
        "Page {page_num}/{total_pages} | {num_tracks} "
        "tracks, {num_remaining} remaining  |  \n\n"
    ).format(
        page_num=page_num,
        total_pages=queue_num_pages,
        num_tracks=len(player.queue) + 1,
        num_remaining=queue_total_duration,
    )
    text += (
        _("Auto-Play")
        + ": "
        + ("\N{WHITE HEAVY CHECK MARK}" if autoplay else "\N{CROSS MARK}")
    )
    text += (
        (" | " if text else "")
        + _("Shuffle")
        + ": "
        + ("\N{WHITE HEAVY CHECK MARK}" if shuffle else "\N{CROSS MARK}")
    )
    text += (
        (" | " if text else "")
        + _("Repeat")
        + ": "
        + ("\N{WHITE HEAVY CHECK MARK}" if repeat else "\N{CROSS MARK}")
    )
    embed.set_footer(text=text)
    return embed


# Traceback (RuntimeError)
Traceback (most recent call last):
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/core.py", line 79, in wrapped
ret = await coro(*args, **kwargs)
File "/home/martinebots/martinebotscogs/cogs_modified/audio/audio.py", line 3183, in play
await self._enqueue_tracks(ctx, query)
File "/home/martinebots/martinebotscogs/cogs_modified/audio/audio.py", line 3885, in _enqueue_tracks
result, called_api = await self.music_cache.lavalink_query(ctx, player, query)
File "/home/martinebots/martinebotscogs/cogs_modified/audio/apis.py", line 911, in lavalink_query
results = await player.load_tracks(query)
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/lavalink/rest_api.py", line 300, in load_tracks
self.__check_node_ready()
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/lavalink/rest_api.py", line 268, in __check_node_ready
raise RuntimeError("Cannot execute REST request when node not ready.")
RuntimeError: Cannot execute REST request when node not ready.

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

Traceback (most recent call last):
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 863, in invoke
await ctx.command.invoke(ctx)
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/core.py", line 728, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/core.py", line 88, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: Cannot execute REST request when node not ready.```

# Fixed code
async def _build_queue_page(
    self, ctx: commands.Context, player: lavalink.player_manager.Player, page_num
):
    shuffle = await self.config.guild(ctx.guild).shuffle()
    repeat = await self.config.guild(ctx.guild).repeat()
    autoplay = await self.config.guild(ctx.guild).auto_play()

    queue_num_pages = math.ceil(len(player.queue) / 10)
    queue_idx_start = (page_num - 1) * 10
    queue_idx_end = queue_idx_start + 10
    queue_list = ""
    try:
        arrow = await draw_time(ctx)
    except AttributeError:
        return await self._embed_msg(ctx, title=_("There's nothing in the queue."))
    pos = lavalink.utils.format_time(player.position)

    if player.current.is_stream:
        dur = "LIVE"
    else:
        dur = lavalink.utils.format_time(player.current.length)

    query = audio_dataclasses.Query.process_input(player.current)

    if query.is_stream:
        queue_list += _("**Currently livestreaming:**\n")
        queue_list += "**[{current.title}]({current.uri})**\n".format(
            current=player.current
        )
        queue_list += _("Requested by: **{user}**").format(
            user=player.current.requester
        )
        queue_list += f"\n\n{arrow}`{pos}`/`{dur}`\n\n"

    elif query.is_local:
        if player.current.title != "Unknown title":
            queue_list += "\n".join(
                (
                    _("Playing: ")
                    + "**{current.author} - {current.title}**".format(
                        current=player.current
                    ),
                    audio_dataclasses.LocalPath(player.current.uri).to_string_user(),
                    _("Requested by: **{user}**\n").format(
                        user=player.current.requester
                    ),
                    f"{arrow}`{pos}`/`{dur}`\n\n",
                )
            )
        else:
            queue_list += "\n".join(
                (
                    _("Playing: ")
                    + audio_dataclasses.LocalPath(player.current.uri).to_string_user(),
                    _("Requested by: **{user}**\n").format(
                        user=player.current.requester
                    ),
                    f"{arrow}`{pos}`/`{dur}`\n\n",
                )
            )
    else:
        queue_list += _("Playing: ")
        queue_list += "**[{current.title}]({current.uri})**\n".format(
            current=player.current
        )
        queue_list += _("Requested by: **{user}**").format(
            user=player.current.requester
        )
        queue_list += f"\n\n{arrow}`{pos}`/`{dur}`\n\n"

    for i, track in enumerate(
        player.queue[queue_idx_start:queue_idx_end], start=queue_idx_start
    ):
        if len(track.title) > 40:
            track_title = str(track.title).replace("[", "")
            track_title = "{}...".format((track_title[:40]).rstrip(" "))
        else:
            track_title = track.title
        req_user = track.requester
        track_idx = i + 1
        query = audio_dataclasses.Query.process_input(track)

        if query.is_local:
            if track.title == "Unknown title":
                queue_list += f"`{track_idx}.` " + ", ".join(
                    (
                        bold(audio_dataclasses.LocalPath(track.uri).to_string_user()),
                        _("requested by **{user}**\n").format(user=req_user),
                    )
                )
            else:
                queue_list += (
                    f"`{track_idx}.` **{track.author} - {track_title}**, "
                    + _("requested by **{user}**\n").format(user=req_user)
                )
        else:
            queue_list += f"`{track_idx}.` **[{track_title}]({track.uri})**, "
            queue_list += _("requested by **{user}**\n").format(user=req_user)

    embed = discord.Embed(
        colour=await ctx.embed_colour(),
        title="Queue for __{guild.name}__".format(guild=ctx.guild),
        description=queue_list,
    )
    if await self.config.guild(ctx.guild).thumbnail() and player.current.thumbnail:
        embed.set_thumbnail(url=player.current.thumbnail)
    queue_dur = await queue_duration(ctx)
    queue_total_duration = lavalink.utils.format_time(queue_dur)
    text = _(
        "Page {page_num}/{total_pages} | {num_tracks} tracks, {num_remaining} remaining\n"
    ).format(
        page_num=page_num,
        total_pages=queue_num_pages,
        num_tracks=len(player.queue) + 1,
        num_remaining=queue_total_duration,
    )
    text += (
        _("Auto-Play")
        + ": "
        + ("\N{WHITE HEAVY CHECK MARK}" if autoplay else "\N{CROSS MARK}")
    )
    text += (
        (" | " if text else "")
        + _("Shuffle")
        + ": "
        + ("\N{WHITE HEAVY CHECK MARK}" if shuffle else "\N{CROSS MARK}")
    )
    text += (
        (" | " if text else "")
        + _("Repeat")
        + ": "
        + ("\N{WHITE HEAVY CHECK MARK}" if repeat else "\N{CROSS MARK}")
    )
    embed.set_footer(text=text)
    return embed