RocketChat/Rocket.Chat · error · Meteor.Error

error-not-allowed

error-not-allowed

Error message

Not allowed

What it means

`restart_server` throws `error-not-allowed` when `hasPermissionAsync(uid, 'restart-server')` fails for the logged-in user. The permission is role-based; admin roles normally carry it, but a workspace can revoke it or the caller may hold a role that never had it.

Source

Thrown at apps/meteor/server/meteor-methods/platform/restartServer.ts:25

	// eslint-disable-next-line @typescript-eslint/naming-convention
	interface ServerMethods {
		restart_server(): {
			message: string;
			params: [number];
		};
	}
}

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

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

		if ((await hasPermissionAsync(uid, 'restart-server')) !== true) {
			throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'restart_server' });
		}

		setTimeout(() => {
			setTimeout(() => {
				console.warn('Call to process.exit() timed out, aborting.');
				process.abort();
			}, 1000);
			process.exit(1);
		}, 1000);

		return {
			message: 'The_server_will_restart_in_s_seconds',
			params: [2],
		};
	},
});

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Call the method as a user whose roles include `restart-server` (typically an admin)
  2. Grant the permission: Administration -> Permissions -> add `restart-server` to the intended role
  3. Hide or disable the restart control for users without the permission
Defensive patterns

Strategy: validation

Validate before calling

// hide/disable the control unless the session user holds the permission
const uid = Meteor.userId();
const allowed = Boolean(uid) && userHasPermission(uid, 'restart-server');
restartButton.disabled = !allowed;

Try / catch

try {
  await Meteor.callAsync('restart_server');
} catch (e) {
  if (e instanceof Meteor.Error && e.error === 'error-not-allowed') {
    showPermissionError('restart-server'); // or hide the control entirely
  }
}

Prevention

When it happens

Trigger: A logged-in user whose roles lack the `restart-server` permission calls `Meteor.call('restart_server')` — a regular user, a bot/service account, or an admin after the permission was removed from the admin role.

Common situations: Permission revoked from the admin role in Administration -> Permissions; custom roles created without `restart-server`; calling through an integration user.

Related errors


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