{"record":{"id":"ed9a8b10a4997b69","repo":"RocketChat/Rocket.Chat","slug":"error-direct-room","errorCode":"error-direct-room","errorMessage":"Can't change type of direct rooms","messagePattern":"Can't change type of direct rooms","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/rooms/settings/saveRoomType.ts","lineNumber":40,"sourceCode":"\t\t\tfunction: 'RocketChat.saveRoomType',\n\t\t});\n\t}\n\tif (roomType !== 'c' && roomType !== 'p') {\n\t\tthrow new Meteor.Error('error-invalid-room-type', 'error-invalid-room-type', {\n\t\t\tfunction: 'RocketChat.saveRoomType',\n\t\t\ttype: roomType,\n\t\t});\n\t}\n\tconst room = await Rooms.findOneById(rid);\n\tif (room == null) {\n\t\tthrow new Meteor.Error('error-invalid-room', 'error-invalid-room', {\n\t\t\tfunction: 'RocketChat.saveRoomType',\n\t\t\t_id: rid,\n\t\t});\n\t}\n\n\tif (!(await roomCoordinator.getRoomDirectives(room.t)?.allowRoomSettingChange(room, RoomSettingsEnum.TYPE))) {\n\t\tthrow new Meteor.Error('error-direct-room', \"Can't change type of direct rooms\", {\n\t\t\tfunction: 'RocketChat.saveRoomType',\n\t\t});\n\t}\n\n\tconst result = await Promise.all([Rooms.setTypeById(rid, roomType), Subscriptions.updateTypeByRoomId(rid, roomType)]);\n\n\tif (!result) {\n\t\treturn result;\n\t}\n\n\tif (roomType === 'c' && room.abacAttributes?.length) {\n\t\tawait Rooms.unsetAbacAttributesById(rid);\n\t}\n\n\tif (result[1]?.modifiedCount) {\n\t\tvoid notifyOnSubscriptionChangedByRoomId(rid);\n\t}\n","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/rooms/settings/saveRoomType.ts#L22-L58","documentation":"Error \"Can't change type of direct rooms\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown in saveRoomType when attempting to convert a direct message room, which is not allowed.","commonSituations":"See trigger scenarios.","solutions":["Do not attempt to change the type of a direct message room; only channels and private groups can be converted."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}