RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-setting-value
error-invalid-setting-value
Error message
Value for setting ${setting._id} must be greater than or equal to ${setting.minValue} What it means
Admin settings save (saveSettings method -> saveSettingsBulk -> checkSettingValueBounds) enforces declared numeric bounds on settings of type 'int' and 'range'. If the submitted value is below the setting's minValue, the save aborts with Meteor error code 'error-invalid-setting-value' and a message naming the setting id and the required minimum. The error details carry { method: 'saveSettings' }.
Source
Thrown at apps/meteor/server/settings/checkSettingValueBonds.ts:14
import type { ISetting } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';
const hasNumericBounds = (setting: ISetting): setting is ISetting & { minValue?: number; maxValue?: number } => {
return setting.type === 'int' || setting.type === 'range';
};
export const checkSettingValueBounds = (setting: ISetting, value?: ISetting['value']): void => {
if (!hasNumericBounds(setting) || !value) {
return;
}
if (setting.minValue !== undefined && Number(value) < setting.minValue) {
throw new Meteor.Error(
'error-invalid-setting-value',
`Value for setting ${setting._id} must be greater than or equal to ${setting.minValue}`,
{ method: 'saveSettings' },
);
}
if (setting.maxValue !== undefined && Number(value) > setting.maxValue) {
throw new Meteor.Error(
'error-invalid-setting-value',
`Value for setting ${setting._id} must be less than or equal to ${setting.maxValue}`,
{ method: 'saveSettings' },
);
}
};
View on GitHub (pinned to b2c16d5842)
Solutions
- Fetch the setting definition (minValue ships with setting metadata) and submit a value >= minValue
- Clamp user or admin input to [minValue, maxValue] in the client or script before calling saveSettings
- If the bound itself is wrong for your deployment, change the setting definition rather than bypassing validation
- Read the error message: it names the exact setting id and required minimum
Example fix
// before
Meteor.call('saveSettings', [{ _id: 'API_User_Limit', value: -5 }]);
// -> error-invalid-setting-value: must be greater than or equal to 0
// after
const s = Settings.findOneById('API_User_Limit');
const value = Math.max(s.minValue ?? -Infinity, -5);
Meteor.call('saveSettings', [{ _id: 'API_User_Limit', value }]); Defensive patterns
Strategy: validation
Validate before calling
const setting = Settings.findOneById(settingId);
const value = Math.max(setting.minValue ?? -Infinity, rawValue);
Meteor.call('saveSettings', [{ _id: settingId, value }]); Type guard
const isWithinBounds = (s: ISetting & { minValue?: number; maxValue?: number }, v: number): boolean =>
(s.minValue === undefined || v >= s.minValue) && (s.maxValue === undefined || v <= s.maxValue); Try / catch
catch (err) {
if (err instanceof Meteor.Error && err.error === 'error-invalid-setting-value') {
// message names the setting and bound; correct the value and re-save
} else throw err;
} Prevention
- Fetch setting metadata (minValue, maxValue) and validate before submit
- Clamp admin-form inputs to declared bounds
- Save settings in small batches so one bad value does not abort unrelated changes
When it happens
Trigger: POSTing to the saveSettings method/API with a numeric setting below its declared minimum, e.g. -10 for a setting whose minValue is 0; automation scripts writing config values that were valid on an older version whose bounds later tightened.
Common situations: Version upgrades that introduce or tighten minValue on existing settings; configurations imported from other workspaces; scripts copying values between environments with different setting definitions.
Related errors
- Invalid JSON provided
- error-invalid-setting-value
- error-name-param-not-provided
- error-id-param-not-provided
- message-length-exceeds-character-limit
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/a09168020aaefc8a.
Report an issue: GitHub.