Skip to content

Threads can become stuck / unresponsive when deleting the channel fails #822

@LostLuma

Description

@LostLuma

When closing a thread its status is updated regardless of whether deleting the channel succeeds, resulting in having a visibly open modmail thread that still records moderator messages in the internal log, but can not be interacted with in any way by either party.

For moderators without manage channel permission this makes this zombie modmail thread impossible to deal with. It'd be preferable if such a deletion issue happens one could use the close command a second or third time.

bot-1   | 2025-03-13T18:02:25.290347056Z DiscordHTTPError: 503 Service Unavailable on DELETE /api/v10/channels/1348977966071156776?
bot-1   | 2025-03-13T18:02:25.290390369Z     at RequestHandler.request (/opt/modmail/node_modules/eris/lib/rest/RequestHandler.js:75:11)
bot-1   | 2025-03-13T18:02:25.290399505Z     at Client.deleteChannel (/opt/modmail/node_modules/eris/lib/Client.js:1179:32)
bot-1   | 2025-03-13T18:02:25.290405889Z     at TextChannel.delete (/opt/modmail/node_modules/eris/lib/structures/GuildChannel.js:46:39)
bot-1   | 2025-03-13T18:02:25.290412614Z     at Thread.close (/opt/modmail/src/data/Thread.js:773:27)
bot-1   | 2025-03-13T18:02:25.290418810Z     at async applyScheduledCloses (/opt/modmail/src/modules/close.js:77:7)
bot-1   | 2025-03-13T18:02:25.290425261Z     at async Timeout.scheduledCloseLoop [as _onTimeout] (/opt/modmail/src/modules/close.js:85:7)

this.status = THREAD_STATUS.CLOSED;
await knex("threads")
.where("id", this.id)
.update({
status: THREAD_STATUS.CLOSED
});
// Delete channel
const channel = bot.getChannel(this.channel_id);
if (channel) {
console.log(`Deleting channel ${this.channel_id}`);
await channel.delete("Thread closed");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions