RocketChat/Rocket.Chat · error · Meteor.Error

error-invalid-user

error-invalid-user

Error message

Invalid user (did you delete the `rocket.cat` user?)

What it means

Thrown in validateOutgoing when Users.findOne({ username: integration.username }) returns null: the 'post as' user named by the integration does not exist. The message points at the most common cause — the built-in rocket.cat bot having been deleted — since rocket.cat is the default username for outgoing integrations. Meteor.Error code 'error-invalid-user'.

Source

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

			for (const channel of channels) {
				if (!validChannelChars.includes(channel[0]) && !scopedChannels.includes(channel.toLowerCase())) {
					throw new Meteor.Error('error-invalid-channel-start-with-chars', 'Invalid channel. Start with @ or #', {
						function: 'validateOutgoing',
					});
				}
			}
		}
	} else if (!(await hasPermissionAsync(userId, 'manage-outgoing-integrations'))) {
		throw new Meteor.Error('error-invalid-permissions', 'Invalid permission for required Integration creation.', {
			function: 'validateOutgoing',
		});
	}

	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',
			});
		}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Point username at an existing user (any real account or bot) and retry
  2. If rocket.cat was deleted, re-create it or run the factory reset/seed so the system user exists again
  3. Verify beforehand with GET /api/v1/users.info?username=rocket.cat

Example fix

// before
{ username: 'rocket.cat' } // rocket.cat was deleted from the workspace

// after — use an existing user
{ username: 'my.bot' }
Defensive patterns

Strategy: validation

Validate before calling

const user = await Users.findOne({ username: integration.username }, { projection: { _id: 1 } });
if (!user) {
  throw new Error(`post-as user '${integration.username}' does not exist`);
}

Prevention

When it happens

Trigger: integrations.create with username 'rocket.cat' on a workspace where that system user was deleted, or with a typo'd/bot-deactivated username ('rocket.cat ' with a space, 'Rocket.Cat' with wrong case, or a bot account that was removed).

Common situations: Fresh restores or trimmed test datasets where the system user was purged; workspaces that disable the bot user and someone deletes it; provisioning scripts that reference a bot before creating it.

Understand the failure class

Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.

Related errors


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