# Trying to invite removed member but getting "This person is already a team member."

**URL:** <https://forum.mattermost.com/t/trying-to-invite-removed-member-but-getting-this-person-is-already-a-team-member/11640>\
**Category:** Troubleshooting\
**Created:** [May 9, 2021, 5:48pm UTC](https://forum.mattermost.com/t/trying-to-invite-removed-member-but-getting-this-person-is-already-a-team-member/11640 "2021-05-09T17:48:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/akito/32/4090_2.png) [@Akito](https://forum.mattermost.com/u/Akito)\
**Post date:** [May 9, 2021, 5:48pm UTC](https://forum.mattermost.com/t/trying-to-invite-removed-member-but-getting-this-person-is-already-a-team-member/11640/1 "2021-05-09T17:48:22Z")

</div>

> [@Unable to save the team member](https://forum.mattermost.com/t/unable-to-save-the-team-member/9578):
>
> Summary I cannot invite/add a user to a team. Steps to reproduce The user already exists on the Mattermost instance and already is in a team. I tried adding them to a second team using the invite feature, but the link didn’t seem to work. So I went and tried with the command line: $ mattermost team add team-name user@example.org Unable to add 'user@example.org' to team-name So I tried using the api: curl -X POST -i -H 'Authorization: Bearer myadmintoken' -d '{"team\_id":"\*\*\*redacted\*\*\*","user…

[https://mattermost.atlassian.net/browse/MM-24573](https://mattermost.atlassian.net/browse/MM-24573)

Mattermost Version: 5.26.0

Database Schema Version: 5.26.0

Database: postgres

Running with `docker-compose`.

PostgreSQL logs:

```auto
LOG: database system was interrupted; last known up at 2021-04-12 23:03:49 UTC
LOG: database system was not properly shut down; automatic recovery in progress
LOG: redo starts at 0/3F5C0A70
LOG: record with zero length at 0/3F5C1360
LOG: redo done at 0/3F5C1330
LOG: last completed transaction was at log time 2021-04-12 23:04:45.920694+00
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
ERROR: relation "idx_teams_description" does not exist
STATEMENT: SELECT $1::regclass
ERROR: duplicate key value violates unique constraint "users_username_key"
DETAIL: Key (username)=(surveybot) already exists.
STATEMENT: insert into "users" ("id","createat","updateat","deleteat","username","password","authdata","authservice","email","emailverified","nickname","firstname","lastname","position","roles","allowmarketing","props","notifyprops","lastpasswordupdate","lastpictureupdate","failedattempts","locale","timezone","mfaactive","mfasecret") values ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25);
ERROR: operator does not exist: boolean = integer at character 67
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
STATEMENT: SELECT COUNT(*) FROM Teams WHERE DeleteAt = 0 AND AllowOpenInvite = 1
ERROR: operator does not exist: boolean = integer at character 67
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
STATEMENT: SELECT COUNT(*) FROM Teams WHERE DeleteAt = 0 AND AllowOpenInvite = 1
ERROR: operator does not exist: boolean = integer at character 67
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
STATEMENT: SELECT COUNT(*) FROM Teams WHERE DeleteAt = 0 AND AllowOpenInvite = 1

```

I previously accidentally removed the wrong member from the team, so I tried to add this member back. The member is obviously missing completely from the Team, yet, when I try to invite this member back into the team, Mattermost is telling me, that the member supposedly is already part of the team.

As can be seen in the log, there is a type problem in the database.

---

<div class="post-metadata">

**Author:** ![Akito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/akito/32/4090_2.png) [@Akito](https://forum.mattermost.com/u/Akito)\
**Post date:** [May 9, 2021, 9:09pm UTC](https://forum.mattermost.com/t/trying-to-invite-removed-member-but-getting-this-person-is-already-a-team-member/11640/2 "2021-05-09T21:09:53Z")

</div>

Restarting the Mattermost instance and its database seems to have solved my problem. Still, the unintended behaviour is still an issue.

---

<div class="post-metadata">

**Author:** ![ahmaddanial](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ahmaddanial/32/2938_2.png) [@ahmaddanial](https://forum.mattermost.com/u/ahmaddanial)\
**Post date:** [May 10, 2021, 4:31am UTC](https://forum.mattermost.com/t/trying-to-invite-removed-member-but-getting-this-person-is-already-a-team-member/11640/3 "2021-05-10T04:31:57Z")

</div>

Hello, @Akito

I would recommend you to consider backing up and upgrading your Mattermost instance to see if the behavior is still reproducible since [[MM-24573] The schema for the scheme\* columns should be booleans, not smallints - Mattermost](https://mattermost.atlassian.net/browse/MM-24573) is an old bug.

We can then determine if the bug should be reopened and reinvestigated again to ensure that it is resolved for good.
