{"record":{"id":"f676543f22c35534","repo":"RocketChat/Rocket.Chat","slug":"error-room-type-not-archivable","errorCode":"error-room-type-not-archivable","errorMessage":"Room type: ${room.t} can not be archived","messagePattern":"Room type: (.+?) can not be archived","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/slashcommands/archiveroom/server.ts","lineNumber":52,"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-archivable', `Room type: ${room.t} can not be archived`);\n\t\t}\n\n\t\tif (!(await hasPermissionAsync(userId, 'archive-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('Duplicate_archived_channel_name', {\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 archiveRoom(room._id, user);\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/slashcommands/archiveroom/server.ts#L34-L70","documentation":"Before archiving, /archive consults roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, ARCHIVE, userId); room types that do not support archiving - by design direct messages ('d') and livechat rooms ('l'), or any custom room type that did not opt in - cause 'error-room-type-not-archivable' with the offending room.t in the message. This is a capability check on the room type, independent of the user's permissions.","triggerScenarios":"Running /archive in a direct message; archiving a livechat room via the slash command; a custom room type registered without an allowMemberAction that permits ARCHIVE.","commonSituations":"Users expecting DMs to be archivable like channels; omnichannel agents trying to tidy livechat rooms; apps registering custom room types without archive support.","solutions":["Use /archive only on channel (c), private group (p) or team rooms - for DMs, hide the conversation instead","For livechat rooms, close the chat via the omnichannel flow rather than archiving","If developing a custom room type, implement allowMemberAction to allow (or explicitly forbid) ARCHIVE","Check room.t in the error message to identify which type rejected the action"],"exampleFix":"// before\nrunSlashCommand('/archive', { rid: directMessageRoomId });\n// -> error-room-type-not-archivable: Room type: d can not be archived\n\n// after\nconst archivable = await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId);\nif (!archivable) return notifyUser('This room type cannot be archived; hide it instead');\nrunSlashCommand('/archive', { rid: room._id });","handlingStrategy":"validation","validationCode":"const archivable = await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId);\nif (!archivable) {\n\treturn notifyUser('This room type cannot be archived');\n}\nrunCommand('/archive', room);","typeGuard":"const isArchivableRoomType = (t: IRoom['t']): boolean => t === 'c' || t === 'p' || t === 't'; // channels, private groups, teams","tryCatchPattern":"catch (err) {\n\tif (err instanceof Meteor.Error && err.error === 'error-room-type-not-archivable') {\n\t\t// read room.t from the message; suggest hiding DMs or closing livechat instead\n\t} else throw err;\n}","preventionTips":["Hide the archive action in DM and livechat UI contexts","For custom room types, decide archive support when registering directives with roomCoordinator","Surface the room type in the error UX so users understand the refusal"],"tags":["slash-command","rooms","room-type","archive","capability-check"],"backgroundTag":"unsupported-room-operation","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}