diff --git a/ui/desktop/src/services/MatrixService.ts b/ui/desktop/src/services/MatrixService.ts index af97cc6245..5885fc20d5 100644 --- a/ui/desktop/src/services/MatrixService.ts +++ b/ui/desktop/src/services/MatrixService.ts @@ -870,7 +870,17 @@ export class MatrixService extends EventEmitter { throw new Error('Client not initialized'); } - await this.client.invite(roomId, userId); + // Ensure userId starts with '@' as required by Matrix + const formattedUserId = userId.startsWith('@') ? userId : `@${userId}`; + + console.log('🔗 Inviting user to room:', { + roomId, + originalUserId: userId, + formattedUserId, + needsFormatting: !userId.startsWith('@') + }); + + await this.client.invite(roomId, formattedUserId); } /**