{"record":{"id":"269779c9cb5af8dc","repo":"RocketChat/Rocket.Chat","slug":"error-not-allowed-269779","errorCode":"error-not-allowed","errorMessage":"Not allowed","messagePattern":"Not allowed","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/rooms/settings/saveRoomName.ts","lineNumber":59,"sourceCode":"\n\treturn responses;\n};\n\nexport async function saveRoomName(\n\trid: string,\n\tdisplayName: string | undefined,\n\tuser: IUser,\n\tsendMessage = true,\n): Promise<string | undefined> {\n\tconst room = await Rooms.findOneById(rid);\n\tif (!room) {\n\t\tthrow new Meteor.Error('error-invalid-room', 'Invalid room', {\n\t\t\tfunction: 'RocketChat.saveRoomdisplayName',\n\t\t});\n\t}\n\n\tif (roomCoordinator.getRoomDirectives(room.t).preventRenaming()) {\n\t\tthrow new Meteor.Error('error-not-allowed', 'Not allowed', {\n\t\t\tfunction: 'RocketChat.saveRoomdisplayName',\n\t\t});\n\t}\n\n\tawait Room.beforeNameChange(room);\n\n\tif (isRoomNativeFederated(room)) {\n\t\tdisplayName = `${displayName}:${room.federation.mrid.split(':').pop()}`;\n\t}\n\n\tif (displayName === room.name) {\n\t\treturn;\n\t}\n\n\tif (!displayName?.trim()) {\n\t\treturn;\n\t}\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/rooms/settings/saveRoomName.ts#L41-L77","documentation":"Thrown by saveRoomName when roomCoordinator.getRoomDirectives(room.t).preventRenaming() returns true (saveRoomName.ts:59). Room-type server directives decide per type whether renaming is allowed; the default registered in roomCoordinator.ts:30 returns false, and no core type overrides it — so in practice this fires only for room types registered (often by enterprise/custom code via roomCoordinator.add) with preventRenaming: () => true. Code 'error-not-allowed', details { function: 'RocketChat.saveRoomdisplayName' }.","triggerScenarios":"Calling saveRoomName on a room whose type was registered with a preventRenaming directive (e.g. certain managed/custom room types); EE/custom room-type plugins that lock their rooms' names; generic settings UI that shows the name field for every room type including locked ones.","commonSituations":"Enterprise deployments with custom room types whose names are system-managed; apps creating rooms of a locked type then trying to rename them; settings screens that do not consult allowRoomSettingChange/preventRenaming before enabling the field.","solutions":["Identify the room type (room.t) and its registration — find the roomCoordinator.add call that sets preventRenaming for it","Do not offer/attempt renames for that type; hide the name field using the same directive in UI logic","If renaming should be allowed, change the directive to return false (or omit it so the default applies)","If you own a custom room type, document that names are immutable for consumers"],"exampleFix":"// before (custom room type locks renaming, caller renames anyway)\nawait saveRoomName(rid, newName, user);\n\n// after\nconst room = await Rooms.findOneById(rid);\nif (roomCoordinator.getRoomDirectives(room.t).preventRenaming()) {\n\tthrow new Meteor.Error('error-not-allowed', 'This room type cannot be renamed');\n}\nawait saveRoomName(rid, newName, user);","handlingStrategy":"validation","validationCode":"const room = await Rooms.findOneById(rid);\nif (!room) throw new Meteor.Error('error-invalid-room', 'Invalid room');\nif (roomCoordinator.getRoomDirectives(room.t).preventRenaming()) {\n\tthrow new Meteor.Error('error-not-allowed', `Rooms of type '${room.t}' cannot be renamed`);\n}\nawait saveRoomName(rid, displayName, user);","typeGuard":null,"tryCatchPattern":"try {\n\tawait saveRoomName(rid, displayName, user);\n} catch (e) {\n\tif (e instanceof Meteor.Error && e.error === 'error-not-allowed') {\n\t\t// room type locks its name: hide/disable the rename affordance for this type\n\t}\n}","preventionTips":["Consult roomCoordinator.getRoomDirectives(room.t).preventRenaming() before showing the name field","When registering custom room types, only set preventRenaming: () => true deliberately and document it","Treat this error as permanent for the room type — do not retry"],"tags":["room","rename","policy","room-type","not-allowed"],"backgroundTag":"operation-not-permitted","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"}