Creating a new room with encryption enabled on a homeserver that has encryption enabled by default throws Encryption is already enabled!.
To Reproduce
Steps to reproduce the behavior:
- Set
encryption_enabled_by_default_for_room_type: invite on homeserver configuration
- Create private space and click on create room
- Select Text Chat
- Make sure slider for
Enable Encryption is checked
- Click Create Room! button
- The following Error dialog should pop up with a message
Encryption is already enabled!
Expected behavior
Room gets created.
Additional context
During room creation, the homeserver can return a room that has encryption already enabled depending on the server's configuration, but this does not get taken into account during room creation in matrix_client.dart. After room creation the enableE2EE flag gets checked, which directly corresponds to the UI slider value, and room encryption is applied depending on the flag.
|
if (args.enableE2EE!) { |
|
await matrixRoom.enableEncryption(); |
|
} |
If the newly created room has encryption already enabled, Room.enableEncryption throws Encryption is already enabled!.
Fix:
Add a guard to the if statement that checks the Room.encrypted flag before trying to apply encryption.
Since the encryption step only depends on the enableE2EE flag, a workaround is to just uncheck the Enable Encryption slider in room creation, which would still create an encrypted room if the homeserver has applied encryption by default.
As a feature, it would be nice if the user gets notified if the encryption was enabled by default, since the room can be encrypted even if the user has unchecked the Enable Encryption switch during room creation.
Console output
Encryption is already enabled! (Room.enableEncryption)
#0 Room.enableEncryption (package:matrix/src/room.dart:2551:20)
#1 MatrixClient.createRoom (package:commet/client/matrix/matrix_client.dart:517:24)
<asynchronous suspension>
#2 GetOrCreateRoom.show.<anonymous closure> (package:commet/ui/pages/get_or_create_room/get_or_create_room.dart:90:35)
<asynchronous suspension>
#3 _GetOrCreateRoomState.onNextButtonPressed (package:commet/ui/pages/get_or_create_room/get_or_create_room.dart:534:22)
<asynchronous suspension>
Device Information
Device
Platform: linux
Version: v0.4.1
Git Hash: c2ee370d18c822673b24b6579842a01b971b1584
Detail: debian
Build Timestamp: 1772620801855 (March 4, 2026)
System Info
Name: CachyOS Linux
Display Server: wayland
Desktop Environment: wayland
Creating a new room with encryption enabled on a homeserver that has encryption enabled by default throws
Encryption is already enabled!.To Reproduce
Steps to reproduce the behavior:
encryption_enabled_by_default_for_room_type: inviteon homeserver configurationEnable Encryptionis checkedEncryption is already enabled!Expected behavior
Room gets created.
Additional context
During room creation, the homeserver can return a room that has encryption already enabled depending on the server's configuration, but this does not get taken into account during room creation in
matrix_client.dart. After room creation theenableE2EEflag gets checked, which directly corresponds to the UI slider value, and room encryption is applied depending on the flag.commet/commet/lib/client/matrix/matrix_client.dart
Lines 516 to 518 in b3f761b
If the newly created room has encryption already enabled,
Room.enableEncryptionthrowsEncryption is already enabled!.Fix:
Add a guard to the if statement that checks the
Room.encryptedflag before trying to apply encryption.Since the encryption step only depends on the
enableE2EEflag, a workaround is to just uncheck the Enable Encryption slider in room creation, which would still create an encrypted room if the homeserver has applied encryption by default.As a feature, it would be nice if the user gets notified if the encryption was enabled by default, since the room can be encrypted even if the user has unchecked the Enable Encryption switch during room creation.
Console output
Device Information
Device
Platform:
linuxVersion:
v0.4.1Git Hash:
c2ee370d18c822673b24b6579842a01b971b1584Detail:
debianBuild Timestamp:
1772620801855 (March 4, 2026)System Info
Name:
CachyOS LinuxDisplay Server:
waylandDesktop Environment:
wayland