element-hq / element-hq/synapse

Unable to change nickname in only one room (duplicate auth_events)

Open
#19,575 2 comments 0 reactions 0 assignees View on GitHub
A-Membership T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

### Description

There's a user in my homeserver that is unable to change his nickname in one specific room. They changed it when going on vacation some months ago and since they are back, the nickname change fails for them, but only on that room.

Every time the user tries to change the nickname globally works, except for this room specifically. Changing it for the room with `/myroomnick` fails as well.

The error is the following:

```
Jan 12 13:18:09 matrix matrix-synapse-worker-23[3897957]: synapse.handlers.message - 1550 - WARNING - PUT-35620 - Denying new event
because 403: Event $17682202892160gVEiz:domain.com has duplicate auth_events for ('m.room.member', '@username:domain.com'): $17516282973717OfdWM:domain.com and $17516282973314tVTeN:domain.com
```

Checking the room history from Element and the database, indeed, the previous nickname change appears to be duplicated. This is how it looks in the database:

```
event_id | type | room_id | origin_server_ts | received_ts | sender | instance_name | stream_ordering | state_key | rejection_reason
---------------------------------+---------------+--------------------------------+------------------+---------------+--------------------+---------------+-----------------+--------------------+------------------
$17516282973314tVTeN:domain.com | m.room.member | !gIpatCzkjPsVlZDsIw:domain.com | 1751628297429 | 1751628297504 | @username:domain.com | worker-15 | 34368317 | @username:domain.com |
$17516282973717OfdWM:domain.com | m.room.member | !gIpatCzkjPsVlZDsIw:domain.com | 1751628297457 | 1751628297597 | @username:domain.com | worker-15 | 34368318 | @username:domain.com |
(2 rows)
```

Is there any way in which we can recover from this situation?

If you need more information, let me know and I'll try to provide it as soon as possible.

### Steps to reproduce

We are not able to reproduce this situation with any other user.

### Homeserver

igalia.com

### Synapse Version

"server_version": "1.147.1"

### Installation Method

pip (from PyPI)

### Database

PostgreSQL 15

### Workers

Multiple workers

### Platform

Debian 12 running inside an LXC

### Configuration

_No response_

### Relevant log output

```shell
Jan 12 13:18:09 matrix matrix-synapse-worker-23[3897957]: synapse.handlers.message - 1550 - WARNING - PUT-35620 - Denying new event
because 403: Event $17682202892160gVEiz:domain.com has duplicate auth_events for ('m.room.member', '@username:domain.com'): $17516282973717OfdWM:domain.com and $17516282973314tVTeN:domain.com
```

### Anything else that would be useful to know?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.