element-hq / element-hq/synapse
KeyError in generate_room_entry
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#9330](https://github.com/matrix-org/synapse/issues/9330).
---
See https://sentry.matrix.org/sentry/synapse-matrixorg/issues/196208/ for background.
This code is breaking because the current state doesn't include a `m.room.create` event:
https://github.com/matrix-org/synapse/blob/5a9cdaa6e9313b1733b5e1492d197021a92083b6/synapse/handlers/room_list.py#L303-L305
Looking in the database a the room it *does* include a create event, but only in the `events` table, not the `current_state_events` (which is made up purely of membership events). It seems there might be a bug here that server left the room but didn't properly clean-up the current state events.
Some conversation around this: https://matrix.to/#/!XaqDhxuTIlvldquJaV:matrix.org/$dLy7NInKFWgQW5zeIfxlEjPHvCGWOuxNV1WhpRy6Epk?via=matrix.org&via=vector.modular.im&via=maunium.net
Contributor guide
Research direction
Start in synapse/handlers/room_list.py around lines 303-305 and review the Sentry report for the generate_room_entry failure. Compare the room's events and current_state_events database records, then trace how leaving a room affects current state cleanup. Done means room listing no longer raises a KeyError when the current state lacks a m.room.create event.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100