RocketChat/Rocket.Chat · error · Meteor.Error

error-invalid-triggerWords

error-invalid-triggerWords

Error message

Invalid triggerWords

What it means

Thrown in validateOutgoing when the event supports trigger words (only sendMessage does) and integration.triggerWords is present but fails Match.test(…, [String]). Trigger words must arrive as an array of strings; after the shape check the server filters out blank entries, but a non-array or mixed-type array is rejected with Meteor.Error code 'error-invalid-triggerWords'.

Source

Thrown at apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts:163

	const user = await Users.findOne({ username: integration.username });

	if (!user) {
		throw new Meteor.Error('error-invalid-user', 'Invalid user (did you delete the `rocket.cat` user?)', { function: 'validateOutgoing' });
	}

	const integrationData: IOutgoingIntegration = {
		...integration,
		scriptEngine: integration.scriptEngine ?? 'isolated-vm',
		type: 'webhook-outgoing',
		channel: channels,
		userId: user._id,
		_createdAt: new Date(),
		_createdBy: await Users.findOne(userId, { projection: { username: 1 } }),
	};

	if (outgoingEvents[integration.event].use.triggerWords && integration.triggerWords) {
		if (!Match.test(integration.triggerWords, [String])) {
			throw new Meteor.Error('error-invalid-triggerWords', 'Invalid triggerWords', {
				function: 'validateOutgoing',
			});
		}

		integrationData.triggerWords = integration.triggerWords.filter((word) => word && word.trim() !== '');
	} else {
		delete integrationData.triggerWords;
	}

	// Default to transpiling with Babel for backwards compatibility; integrations
	// can opt-out per-record by setting `skipTranspile: true` (removed in 9.0.0).
	const skipTranspile = integration.skipTranspile === true;
	integrationData.skipTranspile = skipTranspile;

	if (
		!isScriptEngineFrozen(integrationData.scriptEngine) &&
		integration.scriptEnabled === true &&
		integration.script &&

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Send triggerWords as an array of strings: ['deploy', 'build']
  2. Split CSV input client-side before submitting: csv.split(',').map((s) => s.trim()).filter(Boolean)
  3. Omit the field entirely when no trigger words are needed

Example fix

// before
{ event: 'sendMessage', triggerWords: 'deploy, build' }

// after
{ event: 'sendMessage', triggerWords: ['deploy', 'build'] }
Defensive patterns

Strategy: validation

Validate before calling

if (triggerWords !== undefined && (!Array.isArray(triggerWords) || !triggerWords.every((w) => typeof w === 'string'))) {
  throw new TypeError('triggerWords must be an array of strings');
}

Prevention

When it happens

Trigger: integrations.create with event 'sendMessage' and triggerWords: 'deploy, build' (a single CSV string), triggerWords: ['deploy', 42], or null; also passing triggerWords for events other than sendMessage simply deletes them rather than erroring, so the throw is specific to sendMessage + wrong shape.

Common situations: Users pasting a comma-separated list into the field and the client sending it unsplit; API payloads modeled on the channel CSV behavior; form state defaulting triggerWords to null instead of omitting the key.

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


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