RocketChat/Rocket.Chat · warning · Meteor.Error

error-setting-validation-failed

error-setting-validation-failed

Error message

error.message

What it means

The bulk `saveSettings` method delegates to `saveSettingsBulk`, which validates every entry (type checks per setting type, integer/bounds checks, JSON schema for code settings) and then runs `validateSettingRules(params)` over the whole batch before any write. Any `SettingValidationError` bubbles up as `error-setting-validation-failed` with message `<Setting_Id>_Invalid`, and because validation precedes all writes the batch is all-or-nothing.

Source

Thrown at apps/meteor/server/meteor-methods/settings/saveSettings.ts:46

	) {
		methodDeprecationLogger.method('saveSettings', '9.0.0', '/v1/settings');

		const uid = Meteor.userId();
		if (uid === null) {
			throw new Meteor.Error('error-action-not-allowed', 'Editing settings is not allowed', {
				method: 'saveSetting',
			});
		}

		try {
			await saveSettingsBulk(uid, params, {
				username: (await Meteor.userAsync())!.username!,
				ip: this.connection.clientAddress || '',
				useragent: this.connection.httpHeaders['user-agent'] || '',
			});
		} catch (error) {
			if (error instanceof SettingValidationError) {
				throw new Meteor.Error('error-setting-validation-failed', error.message);
			}
			throw error;
		}

		return true;
	}, {}),
});

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Read the `<Setting_Id>_Invalid` message — it identifies exactly which setting in the batch failed.
  2. Fix or drop that entry and resend; the batch is atomic, so nothing was saved.
  3. When the culprit is unclear, split the batch into individual `saveSetting` calls to isolate failures.
  4. For int/range settings, ensure `Number.isInteger(value)` and respect min/max bounds before sending.

Example fix

// before - one bad entry fails the whole batch
Meteor.call('saveSettings', [{ _id: 'A', value: 1 }, { _id: 'B', value: '{ bad json' }]);

// after - isolate the offender when the batch rejects
try {
  Meteor.call('saveSettings', batch);
} catch (e) {
  if (e.error === 'error-setting-validation-failed') {
    // e.reason is '<Setting_Id>_Invalid': fix or remove that entry and resend
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check the easy bulk failures locally: integers and JSON payloads
const isBulkSaveable = (params: { _id: string; value: any }[]): boolean =>
  params.every(({ value }) => {
    if (typeof value === 'number') return Number.isInteger(value);
    if (typeof value === 'string' && value !== '') { try { JSON.parse(value); } catch { return false; } }
    return true;
  });

Type guard

const isIntegerSetting = (value: unknown): value is number => typeof value === 'number' && Number.isInteger(value);

Try / catch

try {
  await Meteor.callAsync('saveSettings', params);
} catch (e: any) {
  if (e?.error === 'error-setting-validation-failed') {
    // e.reason is '<Setting_Id>_Invalid' - nothing was saved (atomic batch); fix that entry and resend
  }
}

Prevention

When it happens

Trigger: Calling `saveSettings` with an array where at least one entry fails its validation: a JSON `code` setting with schema-invalid content, a value rejected by a setting's `validation` filter, or (from the bulk path) a non-integer int/timespan/range value. The failing setting is named by the `<Setting_Id>_Invalid` message.

Common situations: Admin UI forms that submit many settings at once and fail opaquely; settings-as-code pipelines pushing one bad value that rolls back the whole batch; cross-setting rules that only trip when several values change together.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/dcd082b19fc3037b. Report an issue: GitHub.