RocketChat/Rocket.Chat · error · Meteor.Error

error-invalid-event-type

error-invalid-event-type

Error message

Invalid event type

What it means

Thrown by _verifyRequiredFields while validating a new or updated outgoing integration: the `event` field must be a non-empty string that is a key of the outgoingEvents map. The allowed values are sendMessage, fileUploaded, roomArchived, roomCreated, roomJoined, roomLeft, and userCreated; anything else fails with Meteor.Error code 'error-invalid-event-type'.

Source

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

import { Meteor } from 'meteor/meteor';

import { compileIntegrationScript } from './compileIntegrationScript';
import { isScriptEngineFrozen } from './validateScriptEngine';
import { outgoingEvents } from '../../../../app/integrations/lib/outgoingEvents';
import { parseCSV } from '../../../../lib/utils/parseCSV';
import { hasPermissionAsync, hasAllPermissionAsync } from '../../authorization/hasPermission';

const scopedChannels = ['all_public_channels', 'all_private_groups', 'all_direct_messages'];
const validChannelChars = ['@', '#'];

function _verifyRequiredFields(integration: INewOutgoingIntegration | IUpdateOutgoingIntegration): void {
	if (
		!integration.event ||
		!Match.test(integration.event, String) ||
		integration.event.trim() === '' ||
		!outgoingEvents[integration.event]
	) {
		throw new Meteor.Error('error-invalid-event-type', 'Invalid event type', {
			function: 'validateOutgoing._verifyRequiredFields',
		});
	}

	if (!integration.username || !Match.test(integration.username, String) || integration.username.trim() === '') {
		throw new Meteor.Error('error-invalid-username', 'Invalid username', {
			function: 'validateOutgoing._verifyRequiredFields',
		});
	}

	if (outgoingEvents[integration.event].use.targetRoom && !integration.targetRoom) {
		throw new Meteor.Error('error-invalid-targetRoom', 'Invalid Target Room', {
			function: 'validateOutgoing._verifyRequiredFields',
		});
	}

	if (!Match.test(integration.urls, [String])) {
		throw new Meteor.Error('error-invalid-urls', 'Invalid URLs', {

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Use one of the exact camelCase values: 'sendMessage', 'fileUploaded', 'roomArchived', 'roomCreated', 'roomJoined', 'roomLeft', 'userCreated'
  2. Check the event list served to the UI (apps/meteor/app/integrations/lib/outgoingEvents.ts) or the Admin -> Integrations -> New Outgoing dropdown for canonical values
  3. If reading user input, validate it against the list before calling the API so the error surfaces in your own form

Example fix

// before
{ type: 'webhook-outgoing', event: 'message-sent', ... }

// after
{ type: 'webhook-outgoing', event: 'sendMessage', ... }
Defensive patterns

Strategy: type-guard

Validate before calling

const OUTGOING_EVENTS = ['sendMessage', 'fileUploaded', 'roomArchived', 'roomCreated', 'roomJoined', 'roomLeft', 'userCreated'] as const;
if (!OUTGOING_EVENTS.includes(event)) {
  throw new RangeError(`event must be one of: ${OUTGOING_EVENTS.join(', ')}`);
}

Type guard

const isOutgoingEvent = (e: string): e is OutgoingIntegrationEvent =>
  ['sendMessage', 'fileUploaded', 'roomArchived', 'roomCreated', 'roomJoined', 'roomLeft', 'userCreated'].includes(e);

Prevention

When it happens

Trigger: POST /api/v1/integrations.create (or .update) with type 'webhook-outgoing' where event is omitted, empty, not a string, or misspelled such as 'message-sent', 'send-message', 'MessageSent', or 'file-upload'. Validation runs before any record is created, so nothing is persisted.

Common situations: Developers guessing kebab-case names from other APIs; copy-pasting from outdated docs or blog posts that predate the camelCase event rename; sending the numeric index of a dropdown instead of the value.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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