RocketChat/Rocket.Chat · error

t('Message_deleting_blocked')

Error message

t('Message_deleting_blocked')

What it means

Thrown by the DeleteMessageConfirmModal mutation when chat.data.canDeleteMessage(message) resolves false. This check enforces the server's deletion policy (message ownership, delete permissions, Message_AllowDeleting and related settings) before any delete call is made, so the delete is blocked client-side with the localized 'Message_deleting_blocked' message.

Source

Thrown at apps/meteor/client/views/room/modals/DeleteMessageConfirmModal/DeleteMessageConfirmModal.tsx:31

	reject,
	onCancel,
	message,
}: {
	room?: IRoom;
	chat: ChatAPI;
	resolve: () => void;
	reject: (reason?: any) => void;
	message: IMessage;
	onCancel: () => void;
}) => {
	const { t } = useTranslation();
	const mid = chat.currentEditingMessage.getMID();
	const dispatchToastMessage = useToastMessageDispatch();

	const deleteMessageMutation = useMutation({
		mutationFn: async () => {
			if (!(await chat.data.canDeleteMessage(message))) {
				throw new Error(t('Message_deleting_blocked'));
			}

			await chat.data.deleteMessage(message);
		},
		onSuccess: () => {
			if (mid === message._id) {
				chat.currentEditingMessage.stop();
			}
			chat.composer?.focus();

			dispatchToastMessage({ type: 'success', message: t('Your_entry_has_been_deleted') });
			resolve();
		},
		onError: (error) => {
			dispatchToastMessage({ type: 'error', message: error });
			reject(error);
		},
		onSettled: () => {

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Verify the user's roles include delete-message (own messages) or force-delete-message-to-any-user (others' messages) in Admin > Permissions
  2. Check Admin > Message settings: Message_AllowDeleting enabled, the deletion time frame, and DM restrictions
  3. Refresh the room: the message may already be deleted, making canDeleteMessage fail on a stale reference
Defensive patterns

Strategy: validation

Validate before calling

const canDelete = await chat.data.canDeleteMessage(message);
if (!canDelete) {
	dispatchToastMessage({ type: 'error', message: t('Message_deleting_blocked') });
	return;
}

Try / catch

catch (error) {
	// already user-facing: surface the localized message, do not retry the mutation
	dispatchToastMessage({ type: 'error', message: error });
}

Prevention

When it happens

Trigger: Clicking Delete on someone else's message without the force-delete permission; deleting your own message after Message_AllowDeleting_MustBeWithinTimeFrame elapsed; Message_AllowDeleting disabled workspace-wide; direct-message deletion restricted by Message_AllowDeleting_BlockDirectMessages; the message was already deleted so the permission check fails.

Common situations: Moderator UI shows a delete button that server policy then denies, time window for own-message deletion expired, role lost the delete-message permission, webhook/app-generated messages the user cannot delete.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


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