Cog-Creators / Cog-Creators/Red-DiscordBot

[Audio] Track Error report too long

Open Beginner friendly
#6,794 0 comments 0 reactions 0 assignees View on GitHub
Category: Cogs - Audio Good First Issue Status: PRs Welcome Type: Bug
Dominant language
Python
Stars
5.7k
Forks
2.5k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

### What Red version are you using?

3.5.24

### What were you trying to do?

Catch errors in audio's playback.

### What did you expect to happen?

An embed message in the channel with the traceback received from the Lavalink process.

### What actually happened?

Some of these messages are too long.

```
[21:27:48] ERROR [asyncio] Task exception was never retrieved
future: exception=HTTPException('400 Bad Request (error code: 50035): Invalid Form Body\nIn embeds.0.description: Must be 4096 or fewer in length.')>
Traceback (most recent call last):
File "/Users/aikaterna/red311/lib/python3.11/site-packages/redbot/cogs/audio/core/events/lavalink.py", line 333, in lavalink_event_handler
await message_channel.send(embed=embed)
File "/Users/aikaterna/red311/lib/python3.11/site-packages/discord/abc.py", line 1706, in send
data = await state.http.send_message(channel.id, params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aikaterna/red311/lib/python3.11/site-packages/discord/http.py", line 778, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.description: Must be 4096 or fewer in length.
```

### How can we reproduce this error?

1. Run an instance with audio and a source that provides a long traceback.
2. Wait for an occurrence.
3. Observe the traceback.
...

### Anything else?

I feel that this output could be shortened to a visually reasonable size and perhaps even prompt the user to retrieve their spring.log for more information, without being too overwhelming or wordy. Some services might benefit from an reasonably-sized traceback being able to be shown (2000-4000 characters). This issue could also be remedied by something as simple as a index range on the description while its being constructed in the embed.

Contributor guide

Open the contributing guide

Research direction

The traceback is sent from `cogs/audio/core/events/lavalink.py`, at the `message_channel.send(embed=embed)` call shown in the report. Read how the embed description is built and how playback errors are handled, then run the relevant audio tests. Done means long tracebacks no longer exceed Discord's 4096-character embed-description limit and the error remains useful to the user.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.