RocketChat/Rocket.Chat · error · Meteor.Error
error-not-allowed
error-not-allowed
Error message
Not allowed
What it means
`deleteUserOwnAccount` first checks the `Accounts_AllowDeleteOwnAccount` setting and throws `error-not-allowed` when it is disabled. Self-service account deletion is opt-in in Rocket.Chat; when the setting is off, no user can delete their own account regardless of other permissions. Subsequent checks (valid user id, password verification) never run when this gate trips.
Source
Thrown at apps/meteor/server/meteor-methods/users/deleteUserOwnAccount.ts:23
import { Accounts } from 'meteor/accounts-base';
import { check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import { trim } from '../../../lib/utils/stringUtils';
import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger';
import { deleteUser } from '../../lib/users/deleteUser';
import { settings } from '../../settings';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
deleteUserOwnAccount(password: string, confirmRelinquish?: boolean): Promise<boolean>;
}
}
export const deleteUserOwnAccount = async (fromUserId: string, password: string, confirmRelinquish = false): Promise<boolean> => {
if (!settings.get('Accounts_AllowDeleteOwnAccount')) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'deleteUserOwnAccount',
});
}
if (!fromUserId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'deleteUserOwnAccount',
});
}
const user = await Users.findOneById(fromUserId);
if (!user) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'deleteUserOwnAccount',
});
}
if (user.services?.password && trim(user.services.password.bcrypt)) {View on GitHub (pinned to b2c16d5842)
Solutions
- Enable the feature: Admin → General → Accounts, set 'Allow Delete Own Account' to true (setting id `Accounts_AllowDeleteOwnAccount`).
- Keep it disabled and remove/hide self-deletion UI when retention policy forbids user-initiated deletion.
- For programmatic deletion, use an admin's `deleteUser` path with `confirmRelinquish` as appropriate instead of the self-service method.
Example fix
// before
Meteor.call('deleteUserOwnAccount', password);
// after - only expose self-deletion when the workspace allows it
import { settings } from '@rocket.chat/settings-client'; // reactive public settings source
if (!settings.get('Accounts_AllowDeleteOwnAccount')) {
throw new Error('Self-account deletion is disabled on this server');
}
Meteor.call('deleteUserOwnAccount', password); Defensive patterns
Strategy: validation
Validate before calling
// expose self-deletion only when the server enables it
if (publicSettings.get('Accounts_AllowDeleteOwnAccount') === true) {
await Meteor.callAsync('deleteUserOwnAccount', password);
} Type guard
const isSelfDeletionEnabled = (value: unknown): value is true => value === true;
Try / catch
try {
await Meteor.callAsync('deleteUserOwnAccount', password);
} catch (e: any) {
if (e?.error === 'error-not-allowed') {
// feature disabled server-side: show 'account deletion is disabled' instead of a retry
}
} Prevention
- Read the public Accounts_AllowDeleteOwnAccount setting to decide whether to render self-deletion UI.
- Administrators: enable the setting in Admin → General → Accounts before announcing self-deletion to users.
- Use the admin deleteUser path for compliance-driven removals rather than user self-service.
When it happens
Trigger: Invoking `Meteor.call('deleteUserOwnAccount', password, confirmRelinquish?)` on a workspace where `Accounts_AllowDeleteOwnAccount` is false — e.g. calling the method directly or from an old client while the workspace has the feature disabled.
Common situations: Fresh/self-managed installs where the setting defaults to off; administrators disabling self-deletion for data-retention or compliance and users still attempting it; older clients or scripts that assume the feature is available.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/fbae6deb0c20c1ea.
Report an issue: GitHub.