Fix oversized Audio track error messages #6796
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!6796
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/audio-long-track-errors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes Audio track error messages being dropped when Lavalink's error text exceeds Discord's 4,096-character embed description limit.
Long errors are cut to fit and end with
[Error truncated due to length.]. Bot owners can find the complete error inspring.log.Testing
Added tests for errors at the limit and errors that need truncating.
python -m pytest tests/cogs/audio -q(26 passed)Fixes #6794
Pull request overview
This PR updates the Audio cog’s Lavalink event error reporting to avoid Discord rejecting messages when the embed description exceeds Discord’s 4096-character limit, by truncating long errors and optionally attaching the full error as a text file.
Changes:
_format_track_error()to keep error embed descriptions within Discord’s 4096-character limit while preserving both the beginning and end of long errors.lavalink-track-error.txtviatext_to_file.lavalink.py.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The PR description says new automated coverage was added for short/long errors and the attachment behavior, but there don't appear to be any tests in the repository exercising this code path (no tests reference
lavalink_event_handler,Track Error, orlavalink-track-error.txt). Please add the tests described in the PR summary so this truncation/attachment logic stays protected against regressions.The attached
lavalink-track-error.txtis built fromextra["message"].replace("\n", ""), which removes line breaks from the Lavalink error text. That makes the attachment harder to read and means it isn't the "complete error" as described (it loses original formatting/newlines). Consider keeping the newline-stripped version only for the embed, while attaching the unmodified error text.The linked issue already has 3 other PRs fixing it, closing.
Was asked to make this one as the once submitted before mine was Slop It was posted in Gen chat. @Jackenmen
https://discord.com/channels/133049272517001216/133081046869737472/1530727543467016233
aikaterna [4EVR],
— Sat 25.07.2026 19:04:45
if there's anyone here in the Red community that doesn't have the Contributor role and would like to, I'd much rather have your interpretation of the answer for https://canary.discord.com/channels/133049272517001216/450749498231357450/1530672986234032332 than the AI-driven, personal rep driven PR we got in response to it so far
I see. Nonetheless, I'm not a fan of the approach used in this PR - I'd rather have us just truncate it (with clear indication that it was truncated). A regular user won't get much value out of incredibly lengthy errors that would end up going over the length limit and the bot owner can see the whole error in spring.log anyway.
Thank you for the contribution and sorry we couldn't accept it.
I should add that, if you are still interested in contributing, we'd accept a PR that implements it as described in this comment on the original issue:
https://github.com/Cog-Creators/Red-DiscordBot/issues/6794#issuecomment-6821976842
Pull request closed