RocketChat/Rocket.Chat · error · Meteor.Error

error-invalid-user

error-invalid-user

Error message

Invalid user

What it means

The DDP wrapper for ignoreUser found no authenticated caller: Meteor.userId() returned null, so the method throws error-invalid-user before any subscription checks. The method is deprecated since 9.0.0; the logger points to /v1/chat.ignoreUser as the replacement surface.

Source

Thrown at apps/meteor/server/meteor-methods/users/ignoreUser.ts:55

	const result = await Subscriptions.ignoreUser({ _id: subscription._id, ignoredUser, ignore });

	if (result.modifiedCount) {
		void notifyOnSubscriptionChangedById(subscription._id);
	}

	return !!result;
};

Meteor.methods<ServerMethods>({
	async ignoreUser({ rid, userId: ignoredUser, ignore = true }) {
		methodDeprecationLogger.method('ignoreUser', '9.0.0', '/v1/chat.ignoreUser');
		check(ignoredUser, String);
		check(rid, String);
		check(ignore, Boolean);

		const userId = Meteor.userId();
		if (!userId) {
			throw new Meteor.Error('error-invalid-user', 'Invalid user', {
				method: 'ignoreUser',
			});
		}

		return ignoreUser(userId, { rid, userId: ignoredUser, ignore });
	},
});

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Guard with Meteor.userId() before showing or firing the ignore toggle
  2. Re-authenticate and retry once on this error
  3. Migrate off the deprecated method to the REST equivalent with proper auth headers

Example fix

// before
Meteor.callAsync('ignoreUser', { rid, userId, ignore: true });

// after
if (!Meteor.userId()) {
	throw new Error('login required');
}
await Meteor.callAsync('ignoreUser', { rid, userId, ignore: true });
Defensive patterns

Strategy: validation

Validate before calling

if (!Meteor.userId()) {
	throw new Error('login required');
}
await Meteor.callAsync('ignoreUser', { rid, userId, ignore: true });

Try / catch

try {
	await Meteor.callAsync('ignoreUser', { rid, userId, ignore: true });
} catch (err) {
	if ((err as { error?: string }).error === 'error-invalid-user') {
		// no session — re-login then retry once
	}
}

Prevention

When it happens

Trigger: Meteor.callAsync('ignoreUser', { rid, userId, ignore }) fired without a valid DDP login — guest session, after logout, or expired resume token.

Common situations: Ignore toggles in room member lists clicked on logged-out views; long-lived tabs with expired tokens; calls racing a logout.

Understand the failure class

Background: error-invalid-user: "Invalid user" errors in Rocket.Chat — what they mean and how to fix them — this error's family across 2 libraries.

Related errors


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