{"record":{"id":"bbaa6cb93ac78f4a","repo":"RocketChat/Rocket.Chat","slug":"error-room-type-not-unarchivable","errorCode":"error-room-type-not-unarchivable","errorMessage":"Room type: ${room.t} can not be unarchived","messagePattern":"Room type: (.+?) can not be unarchived","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/slashcommands/unarchiveroom/server.ts","lineNumber":51,"sourceCode":"\t\t}\n\n\t\tconst user = await Users.findOneById(userId, { projection: { username: 1, name: 1 } });\n\t\tif (!user || !isRegisterUser(user)) {\n\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'archiveRoom' });\n\t\t}\n\n\t\tif (!room) {\n\t\t\tvoid api.broadcast('notify.ephemeralMessage', userId, message.rid, {\n\t\t\t\tmsg: i18n.t('Channel_doesnt_exist', {\n\t\t\t\t\tchannelName: channel,\n\t\t\t\t\tlng: settings.get('Language') || 'en',\n\t\t\t\t}),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (!(await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId))) {\n\t\t\tthrow new Meteor.Error('error-room-type-not-unarchivable', `Room type: ${room.t} can not be unarchived`);\n\t\t}\n\n\t\tif (!(await hasPermissionAsync(userId, 'unarchive-room', room._id))) {\n\t\t\tthrow new Meteor.Error('error-not-authorized', 'Not authorized');\n\t\t}\n\n\t\tif (!room.archived) {\n\t\t\tvoid api.broadcast('notify.ephemeralMessage', userId, message.rid, {\n\t\t\t\tmsg: i18n.t('Channel_already_Unarchived', {\n\t\t\t\t\tchannelName: channel,\n\t\t\t\t\tlng: settings.get('Language') || 'en',\n\t\t\t\t}),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tawait unarchiveRoom(room._id, user);\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/slashcommands/unarchiveroom/server.ts#L33-L69","documentation":"Thrown by /unarchiveroom when the room type's coordinator directive does not allow the ARCHIVE member action for this room. roomCoordinator.getRoomDirectives(room.t) resolves the per-type directive (channel, direct message, team, omnichannel, etc.) and allowMemberAction(room, RoomMemberActions.ARCHIVE, userId) returning false — typically for direct messages or room types that cannot be archived/unarchived — produces 'error-room-type-not-unarchivable' with the offending room.t embedded.","triggerScenarios":"Running /unarchiveroom on a direct message room (t='d'), or any custom/registered room type whose directive disallows ARCHIVE, e.g. '/unarchive' inside a DM.","commonSituations":"Users trying to unarchive DMs or livechat rooms; custom room-type apps that did not implement allowMemberAction for ARCHIVE; team discussions of certain types.","solutions":["Only run /unarchive on room types that support archiving (public/private channels).","Check the directive before acting: roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId).","For custom room types, implement/extend the directive so allowMemberAction covers ARCHIVE when the type should support it."],"exampleFix":"// before\nif (!(await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId))) {\n  throw new Meteor.Error('error-room-type-not-unarchivable', `Room type: ${room.t} can not be unarchived`);\n}\n\n// caller-side pre-check\nconst allowed = await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId);\nif (!allowed) {\n  // surface 'this room type cannot be unarchived' UI hint, skip the command\n}","handlingStrategy":"validation","validationCode":"import { roomCoordinator } from '@rocket.chat/core-services';\nconst canArchive = room &&\n  (await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId));\nif (!canArchive) { /* hide the unarchive action for this room type */ }","typeGuard":"const isUnarchivableRoomType = (t: string): boolean => t === 'c' || t === 'p'; // channels & private groups","tryCatchPattern":"try { await Meteor.callAsync('slashCommand', { command: 'unarchiveroom', ... }); } catch (e) { if (isMeteorError(e, 'error-room-type-not-unarchivable')) { /* explain: this room type can't be archived */ return; } throw e; }","preventionTips":["Do not offer unarchive actions on DMs or livechat rooms.","Custom room types: implement allowMemberAction for ARCHIVE explicitly.","Filter archive actions by room type in custom UIs."],"tags":["rocket-chat","slash-command","room-type","archive"],"backgroundTag":"unsupported-operation-for-type","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}