Registration returns HTTP 500 (panic: "Service \"alias\" does not exist or has not been built yet") when auto_join_rooms is non-empty #2012

Closed
opened 2026-07-17 08:57:14 +00:00 by peltikalle · 0 comments

Summary

On a server with a non-empty auto_join_rooms, POST /_matrix/client/v3/register panics and returns 500 M_UNKNOWN for every new registration. The account row is written before the panic, so the account exists and the user can log in afterwards — but the registration request fails, no device/access token is returned, and the user is never auto-joined to the configured rooms.

The trigger is the auto-join step in create_local_account, whose first action is to resolve the room via the alias service. The users-service's lazy Depalias::Service fails to resolve on this path and panics.

Affected versions

  • v26.6.0, v26.6.1, v26.6.2
  • main (relevant code identical to v26.6.2 as of 2026-07-17)

Worked prior to v26.6.0 (auto-join was functioning before upgrading).

Configuration to reproduce

[global]
allow_registration = true
auto_join_rooms = ["#lobby:example.com"] # any non-empty list
suspend_on_register = false
[global.oauth]
compatibility_mode = "disabled" # legacy registration path

Steps to reproduce

  1. Start the server with the config above.
  2. Register a new account via the legacy C-S API (e.g. Element Web / app.element.io, tokient/v3/register with m.login.registration_token auth + username + password.

Expected

200 OK with user_id, access_token, device_id; the new user is auto-joined to #lobby:example.com

Actual

Client receives:
MatrixError: [500] M_UNKNOWN: Internal server error occurred
(POST https://matrix.example.com/_matrix/client/v3/register)
Server logs (worker thread panics):
ERROR conduwuit_core::error::log: Service "alias" does not exist or has not been built yet. in conduwuit_api::client::account::register::register
thread 'conduwuit:worker' panicked at src/service/service.rs:136:10:
Failure to reference service required by another service.: Service "alias" does not exist or has not been built yet.
ERROR conduwuit_router::request: 500 Internal Server Error, method: POST, uri: /_matrix/

The account is nonetheless created (it can be logged into afterwards); only the registration request fails and no auto-join occurs.

Root cause (analysis)

register_route → create_local_account writes the account first, then runs the auto-join loop:

  • src/api/client/account/register.rs:100 calls create_local_account.
  • src/service/users/account.rs:140-143 creates/persists the account.
  • src/service/users/account.rs:218-219 — the loop's first statement dereferences the alias service:
    for room in &self.services.config.auto_join_rooms {
    let Ok(room_id) = self.services.alias.resolve(room).await else { … };

self.services.alias is a lazy Depalias::Service (src/service/users/mod.rs:59, wired at :111). On first deref it calls require() (src/service/service.rs:133-137), which looks the service up by name and gets None, so it panics.

Workaround

Set auto_join_rooms = [] and invite users to the room(s) by other means.

Environment

  • continuwuity v26.6.2 (ghcr.io/continuwuity/continuwuity:v26.6.2), legacy registration = "disabled").
**Summary** On a server with a non-empty auto_join_rooms, POST /_matrix/client/v3/register panics and returns 500 M_UNKNOWN for every new registration. The account row is written before the panic, so the account exists and the user can log in afterwards — but the registration request fails, no device/access token is returned, and the user is never auto-joined to the configured rooms. The trigger is the auto-join step in create_local_account, whose first action is to resolve the room via the alias service. The users-service's lazy Dep<alias::Service> fails to resolve on this path and panics. **Affected versions** - v26.6.0, v26.6.1, v26.6.2 - main (relevant code identical to v26.6.2 as of 2026-07-17) Worked prior to v26.6.0 (auto-join was functioning before upgrading). **Configuration to reproduce** [global] allow_registration = true auto_join_rooms = ["#lobby:example.com"] # any non-empty list suspend_on_register = false [global.oauth] compatibility_mode = "disabled" # legacy registration path **Steps to reproduce** 1. Start the server with the config above. 2. Register a new account via the legacy C-S API (e.g. Element Web / app.element.io, tokient/v3/register with m.login.registration_token auth + username + password. **Expected** 200 OK with user_id, access_token, device_id; the new user is auto-joined to #lobby:example.com **Actual** Client receives: MatrixError: [500] M_UNKNOWN: Internal server error occurred (POST https://matrix.example.com/_matrix/client/v3/register) Server logs (worker thread panics): ERROR conduwuit_core::error::log: Service "alias" does not exist or has not been built yet. in conduwuit_api::client::account::register::register thread 'conduwuit:worker' panicked at src/service/service.rs:136:10: Failure to reference service required by another service.: Service "alias" does not exist or has not been built yet. ERROR conduwuit_router::request: 500 Internal Server Error, method: POST, uri: /_matrix/ The account is nonetheless created (it can be logged into afterwards); only the registration request fails and no auto-join occurs. **Root cause (analysis)** register_route → create_local_account writes the account first, then runs the auto-join loop: - src/api/client/account/register.rs:100 calls create_local_account. - src/service/users/account.rs:140-143 creates/persists the account. - src/service/users/account.rs:218-219 — the loop's first statement dereferences the alias service: for room in &self.services.config.auto_join_rooms { let Ok(room_id) = self.services.alias.resolve(room).await else { … }; self.services.alias is a lazy Dep<alias::Service> (src/service/users/mod.rs:59, wired at :111). On first deref it calls require() (src/service/service.rs:133-137), which looks the service up by name and gets None, so it panics. **Workaround** Set auto_join_rooms = [] and invite users to the room(s) by other means. **Environment** - continuwuity v26.6.2 (ghcr.io/continuwuity/continuwuity:v26.6.2), legacy registration = "disabled").
Jade closed this issue 2026-07-17 17:57:51 +00:00
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#2012
No description provided.