Fetching audit logs when there is an AutoMod blocked message event throws an error

Fetching audit logs that contain an AutoMod blocked message event throws an error. How can I fix this?
guild.fetchAuditLogs({
limit: 1,
})
guild.fetchAuditLogs({
limit: 1,
})
--------ERROR-------
C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\GuildAuditLogs.js:489
this.target = this.changes.reduce((o, c) => {
^
TypeError: Cannot read properties of null (reading 'reduce')
at new GuildAuditLogsEntry (C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\GuildAuditLogs.js:489:34)
at new GuildAuditLogs (C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\GuildAuditLogs.js:202:21)
at Function.build (C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\GuildAuditLogs.js:212:18)
at Guild.fetchAuditLogs (C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\Guild.js:796:27)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (C:\Users\proba\OneDrive\Desktop\CreatorBot\events\guild\guildMemberUpdate.js:13:33)
--------ERROR-------
C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\GuildAuditLogs.js:489
this.target = this.changes.reduce((o, c) => {
^
TypeError: Cannot read properties of null (reading 'reduce')
at new GuildAuditLogsEntry (C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\GuildAuditLogs.js:489:34)
at new GuildAuditLogs (C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\GuildAuditLogs.js:202:21)
at Function.build (C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\GuildAuditLogs.js:212:18)
at Guild.fetchAuditLogs (C:\Users\proba\OneDrive\Desktop\CreatorBot\node_modules\discord.js\src\structures\Guild.js:796:27)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (C:\Users\proba\OneDrive\Desktop\CreatorBot\events\guild\guildMemberUpdate.js:13:33)
6 Replies
monbrey
monbrey3y ago
I think this has been fixed in v14
probablyraging
probablyragingOP3y ago
Awesome, thanks again for the info
nick.
nick.3y ago
Any chance this will be backported to v13? This is a pretty major issue
monbrey
monbrey3y ago
Maybe I just mean, it's not my call
megatank58
megatank583y ago
should be pretty easy to port
GitHub
GitHub3y ago
<:pr_merge:852715380282753044> #8076 in discordjs/discord.js by Jiralite merged <t:1655143402:R> fix(AuditLog): default changes to empty array
Want results from more Discord servers?
Add your server