{"record":{"id":"85ba8962f50c9942","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-settings-85ba89","errorCode":"error-invalid-settings","errorMessage":"Invalid settings provided","messagePattern":"Invalid settings provided","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts","lineNumber":475,"sourceCode":"\tif (!userId) {\n\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', {\n\t\t\tfunction: 'RocketChat.saveRoomName',\n\t\t});\n\t}\n\tif (!Match.test(rid, String)) {\n\t\tthrow new Meteor.Error('error-invalid-room', 'Invalid room', {\n\t\t\tmethod: 'saveRoomSettings',\n\t\t});\n\t}\n\n\tif (typeof settings !== 'object') {\n\t\tsettings = {\n\t\t\t[settings]: value,\n\t\t};\n\t}\n\n\tif (!Object.keys(settings).every((key) => fields.includes(key as keyof typeof settings))) {\n\t\tthrow new Meteor.Error('error-invalid-settings', 'Invalid settings provided', {\n\t\t\tmethod: 'saveRoomSettings',\n\t\t});\n\t}\n\n\tconst room = await Rooms.findOneById(rid);\n\n\tif (!room) {\n\t\tthrow new Meteor.Error('error-invalid-room', 'Invalid room', {\n\t\t\tmethod: 'saveRoomSettings',\n\t\t});\n\t}\n\n\tif (!(await hasPermissionAsync(userId, 'edit-room', rid))) {\n\t\tif (!(Object.keys(settings).includes('encrypted') && room.t === 'd')) {\n\t\t\tthrow new Meteor.Error('error-action-not-allowed', 'Editing room is not allowed', {\n\t\t\t\tmethod: 'saveRoomSettings',\n\t\t\t\taction: 'Editing_room',\n\t\t\t});","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts#L457-L493","documentation":"saveRoomSettings only accepts setting keys present in its internal whitelist: roomAvatar, featured, roomName, roomTopic, roomAnnouncement, roomCustomFields, roomDescription, roomType, readOnly, reactWhenReadOnly, systemMessages, default, joinCode, retentionEnabled, retentionMaxAge, retentionExcludePinned, retentionFilesOnly, retentionIgnoreThreads, retentionOverrideGlobal, encrypted, favorite. If any submitted key is outside this list, error-invalid-settings is thrown and nothing is saved.","triggerScenarios":"Meteor.call('saveRoomSettings', rid, { roomtopic: 'x' }) (wrong casing), keys not managed by this method such as 'broadcast', 'fname' or 'archived', or the legacy (rid, settingName, value) call form with a non-whitelisted settingName.","commonSituations":"Typos or wrong casing of setting names; setting names renamed across Rocket.Chat versions; code that forwards an arbitrary settings object from an external API or importer straight into the method.","solutions":["Use only whitelisted setting names with exact casing (roomName, roomTopic, retentionFilesOnly, encrypted, favorite, ...)","Filter the payload before calling: drop keys not in the whitelist instead of sending them through","Type the payload as Partial<RoomSettings> so unknown keys fail at compile time","Check the fields array in apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts when unsure which names are accepted"],"exampleFix":"// before\nMeteor.call('saveRoomSettings', rid, { roomtopic: 'New topic' }); // typo: unknown key\n\n// after\nMeteor.call('saveRoomSettings', rid, { roomTopic: 'New topic' });","handlingStrategy":"validation","validationCode":"const ALLOWED = ['roomAvatar','featured','roomName','roomTopic','roomAnnouncement','roomCustomFields','roomDescription','roomType','readOnly','reactWhenReadOnly','systemMessages','default','joinCode','retentionEnabled','retentionMaxAge','retentionExcludePinned','retentionFilesOnly','retentionIgnoreThreads','retentionOverrideGlobal','encrypted','favorite'] as const;\n\nconst payload = Object.fromEntries(\n  Object.entries(settings).filter(([key]) => ALLOWED.includes(key as (typeof ALLOWED)[number])),\n);","typeGuard":"const isRoomSettingKey = (k: string): k is keyof RoomSettings =>\n  ['roomAvatar','featured','roomName','roomTopic','roomAnnouncement','roomCustomFields','roomDescription','roomType','readOnly','reactWhenReadOnly','systemMessages','default','joinCode','retentionEnabled','retentionMaxAge','retentionExcludePinned','retentionFilesOnly','retentionIgnoreThreads','retentionOverrideGlobal','encrypted','favorite'].includes(k);","tryCatchPattern":"try {\n  await Meteor.callAsync('saveRoomSettings', rid, payload);\n} catch (error) {\n  if (error instanceof Meteor.Error && error.error === 'error-invalid-settings') {\n    // log payload keys, diff them against the whitelist, fix casing/typos\n  }\n}","preventionTips":["Type payloads as Partial<RoomSettings> so unknown keys are compile errors","Do not forward arbitrary foreign settings objects into the method; whitelist first","Watch setting names across Rocket.Chat upgrades — the accepted list lives in the fields array of saveRoomSettings.ts"],"tags":["validation","settings","meteor-methods"],"backgroundTag":"schema-validation-failed","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}