RocketChat/Rocket.Chat · error · Error

error-offline-form-disabled

error-offline-form-disabled

Error message

error-offline-form-disabled

What it means

Thrown by `sendOfflineMessage(data)` when the `Livechat_display_offline_form` setting is false. The offline-message email pipeline refuses to run when the offline form feature is switched off server-side, regardless of payload validity.

Source

Thrown at apps/meteor/server/lib/omnichannel/messages.ts:31

import { callbacks } from '../callbacks';
import { deleteMessage as deleteMessageFunc } from '../messages/deleteMessage';
import { sendMessage as sendMessageFunc } from '../messages/sendMessage';
import { updateMessage as updateMessageFunc } from '../messages/updateMessage';
import * as Mailer from '../notifications/email/api';

const dnsResolveMx = util.promisify(dns.resolveMx);

type OfflineMessageData = {
	message: string;
	name: string;
	email: string;
	department?: string;
	host?: string;
};

export async function sendOfflineMessage(data: OfflineMessageData) {
	if (!settings.get('Livechat_display_offline_form')) {
		throw new Error('error-offline-form-disabled');
	}

	const { message, name, email, department, host } = data;

	if (!email) {
		throw new Error('error-invalid-email');
	}

	const emailMessage = `${message}`.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br>$2');

	let html = '<h1>New livechat message</h1>';
	if (host && host !== '') {
		html = html.concat(`<p><strong>Sent from:</strong><a href='${host}'> ${host}</a></p>`);
	}
	html = html.concat(`
			<p><strong>Visitor name:</strong> ${name}</p>
			<p><strong>Visitor email:</strong> ${email}</p>
			<p><strong>Message:</strong><br>${emailMessage}</p>`);

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Enable `Livechat_display_offline_form` in the admin settings if the offline form is wanted
  2. Otherwise stop calling sendOfflineMessage and hide the offline form in the widget; check the setting first
  3. In integrations, read the public livechat config (it exposes offline-form availability) before attempting submission

Example fix

// before
await sendOfflineMessage(data);

// after
if (!settings.get('Livechat_display_offline_form')) {
  return showChatClosedMessage();
}
await sendOfflineMessage(data);
Defensive patterns

Strategy: validation

Validate before calling

if (!settings.get('Livechat_display_offline_form')) {
  return showUnavailableMessage();
}
await sendOfflineMessage(data);

Type guard

const offlineFormEnabled = (): boolean =>
  settings.get<boolean>('Livechat_display_offline_form') === true;

Try / catch

try {
  await sendOfflineMessage(data);
} catch (e) {
  if (e instanceof Error && e.message === 'error-offline-form-disabled') {
    // hide the form; feature switched off server-side
  }
}

Prevention

When it happens

Trigger: Posting to the offline-message flow (widget 'leave a message' form or its REST/Meteor backing) while Administration > Omnichannel > ... has 'Livechat_display_offline_form' disabled — e.g. server config changed after the widget was deployed.

Common situations: Admins disable the offline form expecting the widget to stop offering it, but a cached/old widget still posts; API consumers reusing a flow against a workspace whose settings changed; automation that assumes the form is always on.

Related errors


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