RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-settings
error-invalid-settings
Error message
Invalid settings provided
What it means
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.
Source
Thrown at apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts:475
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
function: 'RocketChat.saveRoomName',
});
}
if (!Match.test(rid, String)) {
throw new Meteor.Error('error-invalid-room', 'Invalid room', {
method: 'saveRoomSettings',
});
}
if (typeof settings !== 'object') {
settings = {
[settings]: value,
};
}
if (!Object.keys(settings).every((key) => fields.includes(key as keyof typeof settings))) {
throw new Meteor.Error('error-invalid-settings', 'Invalid settings provided', {
method: 'saveRoomSettings',
});
}
const room = await Rooms.findOneById(rid);
if (!room) {
throw new Meteor.Error('error-invalid-room', 'Invalid room', {
method: 'saveRoomSettings',
});
}
if (!(await hasPermissionAsync(userId, 'edit-room', rid))) {
if (!(Object.keys(settings).includes('encrypted') && room.t === 'd')) {
throw new Meteor.Error('error-action-not-allowed', 'Editing room is not allowed', {
method: 'saveRoomSettings',
action: 'Editing_room',
});View on GitHub (pinned to b2c16d5842)
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
Example fix
// before
Meteor.call('saveRoomSettings', rid, { roomtopic: 'New topic' }); // typo: unknown key
// after
Meteor.call('saveRoomSettings', rid, { roomTopic: 'New topic' }); Defensive patterns
Strategy: validation
Validate before calling
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; const payload = Object.fromEntries( Object.entries(settings).filter(([key]) => ALLOWED.includes(key as (typeof ALLOWED)[number])), );
Type guard
const isRoomSettingKey = (k: string): k is keyof RoomSettings => ['roomAvatar','featured','roomName','roomTopic','roomAnnouncement','roomCustomFields','roomDescription','roomType','readOnly','reactWhenReadOnly','systemMessages','default','joinCode','retentionEnabled','retentionMaxAge','retentionExcludePinned','retentionFilesOnly','retentionIgnoreThreads','retentionOverrideGlobal','encrypted','favorite'].includes(k);
Try / catch
try {
await Meteor.callAsync('saveRoomSettings', rid, payload);
} catch (error) {
if (error instanceof Meteor.Error && error.error === 'error-invalid-settings') {
// log payload keys, diff them against the whitelist, fix casing/typos
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- error-invalid-name
- error-shield-disabled
- message-length-exceeds-character-limit
- error-name-param-not-provided
- error-id-param-not-provided
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/85ba8962f50c9942.
Report an issue: GitHub.