PermanentDeleteChannel fails with "failed to get a thread"


A customer is seeing this error come up when they try to delete a channel using mmctl or the inbuilt cli:

{"level":"error","ts":1609946082.091247,"caller":"mlog/log.go:229","msg":"Unable to delete the posts by channel.","path":"/api/v4/channels/kknpcbkdafg7uchk8i34jercrw","request_id":"1i71xpj5m7fwfbrotqd7nonxww","ip_addr":"xxx","user_id":"hx9inobaef8wuruqgiwc3bbzsr","method":"DELETE","err_where":"PermanentDeleteChannel","http_code":500,"err_details":"failed to get a thread: resource: Thread id: 8phskmna5bn13k4axbamhsmnja"}

This is happening on 5.29.1

The issue seems to be fixed in 5.30 (

PermanentDeleteUser is also affected by the same issue:

QA Test Steps

-successfully deleted users and channels with mmctl
-no error


Ogi Marusic
February 12, 2021, 12:44 AM

Tested and passed on v5.32

QA Note: PR labelled. Closing.

Ogi Marusic
February 4, 2021, 10:22 PM

Tested and passed on v5.31.1-rc1

QA Note: added done-5.31 label, leaving open to test on v5.32

Daniel Espino Garcia
January 27, 2021, 10:43 AM

Bug seems to be introduced by .

Fix should work for all versions (current and any cherrypick for a dot release we might want to do on previous versions).

PR here:

Colton Shaw
January 22, 2021, 8:41 PM

I am hitting this same issue in my customer's environment using user delete [ID]. This seems related to posts that have RootID and ParentID configured. We deleted all rows associated with the UserID that had Root/Parent IDs and it resolved the delete issue.

Eric Sethna
January 13, 2021, 5:43 PM

does this impact users transitioning to use collapsed reply threads?

Your pinned fields
Click on the next to a field label to start pinning.


Daniel Espino Garcia

QA Assignee

Ogi Marusic


Claudio Costa

Mattermost Team

Sustained Engineering

QA Testing Areas