Joining inexistant room on homeserver via _matrix/client/v3/rooms/{roomId}/join fails with 500 M_UNKNOWN #1443

Open
opened 2026-02-23 21:11:08 +00:00 by JasonGantner · 0 comments

A call to _matrix/client/v3/rooms/{roomId}/join with an inexistant room ID triggers an error in continunuwuity that gets translated to a 500 M_UNKNOWN response instead of a 4XX response.

The spec only defines the 403 HTTP code for this endpoint with a limited number of examples.

logs from latest release:

conduwuit_api::client::membership::join: Joining {roomId}:{homeserver} over federation.
conduwuit_api::client::membership::join: All 1 servers were unable to assist in joining {roomId}:{homeserver} :(

nex located the code here and commented:

The way room joins work rn is they try to join locally, and if they can't, fetch all servers in the room (if possible) and start asking them. There's then a short-circuit that aborts early if the only server in the room is our own, but this means that the remote join helper function sees this as a join failure, not simply a missing room
That might actually be pretty easy to update to be a 404 come to think of it, just one specific return statement iirc

Possible error notification options are:

  • 403 M_UNKNOWN or other generic message (prevent malicious users to enumerate room ids this way)
  • 404 M_UNKNOWN (mimic synapse's behaviour)
  • 404 M_NOT_FOUND (proper HTTP+Matrix codes)
  • 403 M_NOT_FOUND (HTTP code from spec + error code for reason)
A call to _matrix/client/v3/rooms/{roomId}/join with an inexistant room ID triggers an error in continunuwuity that gets translated to a 500 M_UNKNOWN response instead of a 4XX response. The spec only defines the 403 HTTP code for this endpoint with a limited number of examples. logs from latest release: ``` conduwuit_api::client::membership::join: Joining {roomId}:{homeserver} over federation. conduwuit_api::client::membership::join: All 1 servers were unable to assist in joining {roomId}:{homeserver} :( ``` nex located the code [here](https://forgejo.ellis.link/continuwuation/continuwuity/src/commit/cb9786466bee299c1260171cee2a5ca407bda108/src/api/client/membership/join.rs#L787-L789) and commented: > The way room joins work rn is they try to join locally, and if they can't, fetch all servers in the room (if possible) and start asking them. There's then a short-circuit that aborts early if the only server in the room is our own, but this means that the remote join helper function sees this as a join failure, not simply a missing room > That might actually be pretty easy to update to be a 404 come to think of it, just one specific return statement iirc Possible error notification options are: - 403 M_UNKNOWN or other generic message (prevent malicious users to enumerate room ids this way) - 404 M_UNKNOWN (mimic synapse's behaviour) - 404 M_NOT_FOUND (proper HTTP+Matrix codes) - 403 M_NOT_FOUND (HTTP code from spec + error code for reason)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity#1443
No description provided.