Skip to content

Fix AttributeError in log_uncached_deleted_message when channel is None#3499

Open
oliveman-au wants to merge 1 commit intopython-discord:mainfrom
oliveman-au:fix/modlog-attributeerror-uncached-delete
Open

Fix AttributeError in log_uncached_deleted_message when channel is None#3499
oliveman-au wants to merge 1 commit intopython-discord:mainfrom
oliveman-au:fix/modlog-attributeerror-uncached-delete

Conversation

@oliveman-au
Copy link
Copy Markdown

self.bot.get_channel() can return None if the channel isn't in the bot's cache, but channel.category was being accessed immediately after with no None check, causing an AttributeError.

This is particularly impactful because log_uncached_deleted_message is called for every deleted message that isn't in the cache, which on a large server happens constantly. Every one of those events would silently crash the handler instead of logging.

Added an early return with a trace log if the channel can't be found, matching the pattern used elsewhere in the codebase.

@oliveman-au oliveman-au requested a review from mbaruh as a code owner April 24, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant