RocketChat/Rocket.Chat · error · Meteor.Error

error-invalid-user

error-invalid-user

Error message

Invalid user

What it means

checkFederationConfiguration validates the workspace's federation bridge; it first requires an authenticated user (Meteor.userId()), otherwise error-invalid-user. It is a privileged admin operation that probes homeserver/appservice connectivity.

Source

Thrown at apps/meteor/server/meteor-methods/platform/checkFederationConfiguration.ts:18

import { Federation, FederationEE, Authorization } from '@rocket.chat/core-services';
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { License } from '@rocket.chat/license';
import { Meteor } from 'meteor/meteor';

declare module '@rocket.chat/ddp-client' {
	// eslint-disable-next-line @typescript-eslint/naming-convention
	interface ServerMethods {
		checkFederationConfiguration(): Promise<{ message: string }>;
	}
}

Meteor.methods<ServerMethods>({
	async checkFederationConfiguration() {
		const uid = Meteor.userId();

		if (!uid) {
			throw new Meteor.Error('error-invalid-user', 'Invalid user', {
				method: 'checkFederationConfiguration',
			});
		}

		if (!(await Authorization.hasPermission(uid, 'view-privileged-setting'))) {
			throw new Meteor.Error('error-not-allowed', 'Action not allowed', {
				method: 'checkFederationConfiguration',
			});
		}

		const errors: string[] = [];

		const successes: string[] = [];

		const service = License.hasValidLicense() ? FederationEE : Federation;

		const status = await service.configurationStatus();

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Authenticate before calling (valid DDP login, or run the check from the logged-in admin UI)
  2. Check Meteor.userId() client-side and re-authenticate when this error appears
  3. For headless automation, use authenticated REST calls rather than raw Meteor methods

Example fix

// before
Meteor.call('checkFederationConfiguration');

// after
if (!Meteor.userId()) await ensureLogin();
const { message } = await Meteor.callAsync('checkFederationConfiguration');
Defensive patterns

Strategy: validation

Validate before calling

if (!Meteor.userId()) {
  await ensureLogin();
}
const { message } = await Meteor.callAsync('checkFederationConfiguration');

Type guard

const isInvalidUserError = (e: unknown): e is Meteor.Error =>
  typeof e === 'object' && e !== null && (e as { error?: string }).error === 'error-invalid-user';

Try / catch

try {
  await Meteor.callAsync('checkFederationConfiguration');
} catch (e) {
  if (isInvalidUserError(e)) {
    await reauthenticate();
    return Meteor.callAsync('checkFederationConfiguration');
  }
  throw e;
}

Prevention

When it happens

Trigger: Invoking checkFederationConfiguration over a DDP connection without a logged-in user; an expired login token; automation calling the method without credentials.

Common situations: Scripts hitting admin methods without authentication; token expiry during long-lived sessions; UI invoking the check before authentication completes.

Related errors


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