We're Hiring!

Mattermost, Inc.

Error When Deleting User Using mmctl

Problem
Attempting to delete user via mmctl user delete fails with an error.

Environment
Mattermost Server with mmctl installed.

Diagnosis

ahmaddanial@mattermost:/opt/mattermost$ mmctl user delete ahmad.danial@mattermost.com
WARNING: server version 5.29.0.5.29.0.45a60588b1ed9e0018bed1e1377071b9.true doesn't match mmctl version 5.28.0
Have you performed a database backup? (YES/NO):
YES
Are you sure you want to delete the users specified? All data will be permanently deleted? (YES/NO):
YES
Unable to delete user 'ahmad.danial' error: : Permanent user deletion feature is not enabled. Please contact your System Administrator.,

Cause
The EnableAPIUserDeletion is set to false.

Resolution
Make the change to the parameter via config.json to set it to true before running the mmctl user delete command again:

ahmaddanial@mattermost:/opt/mattermost$ mmctl user delete ahmad.danial@mattermost.com
WARNING: server version 5.29.0.5.29.0.45a60588b1ed9e0018bed1e1377071b9.true doesn't match mmctl version 5.28.0
Have you performed a database backup? (YES/NO):
YES
Are you sure you want to delete the users specified? All data will be permanently deleted? (YES/NO):
YES
Deleted user 'ahmad.danial'
3 Likes

but even when it is set to true, this does only work in a standard installation and not inside a docker container installation with PostgreSQL database:

root@abc:/var/xyz/mattermost# docker-compose exec app sh
~ $ mmctl user delete u78yrxgftpg89bwijmy6ez98we --confirm --local
Unable to delete user ‘username’ error: : Konnte die zu löschenden Nachrichten für den Benutzer nicht auswählen.,
(Could not select the messages for the user to delete)