{"record":{"id":"e0a09f1584aa8904","repo":"RocketChat/Rocket.Chat","slug":"error-offline-form-disabled","errorCode":"error-offline-form-disabled","errorMessage":"error-offline-form-disabled","messagePattern":"error-offline-form-disabled","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/omnichannel/messages.ts","lineNumber":31,"sourceCode":"import { callbacks } from '../callbacks';\nimport { deleteMessage as deleteMessageFunc } from '../messages/deleteMessage';\nimport { sendMessage as sendMessageFunc } from '../messages/sendMessage';\nimport { updateMessage as updateMessageFunc } from '../messages/updateMessage';\nimport * as Mailer from '../notifications/email/api';\n\nconst dnsResolveMx = util.promisify(dns.resolveMx);\n\ntype OfflineMessageData = {\n\tmessage: string;\n\tname: string;\n\temail: string;\n\tdepartment?: string;\n\thost?: string;\n};\n\nexport async function sendOfflineMessage(data: OfflineMessageData) {\n\tif (!settings.get('Livechat_display_offline_form')) {\n\t\tthrow new Error('error-offline-form-disabled');\n\t}\n\n\tconst { message, name, email, department, host } = data;\n\n\tif (!email) {\n\t\tthrow new Error('error-invalid-email');\n\t}\n\n\tconst emailMessage = `${message}`.replace(/([^>\\r\\n]?)(\\r\\n|\\n\\r|\\r|\\n)/g, '$1<br>$2');\n\n\tlet html = '<h1>New livechat message</h1>';\n\tif (host && host !== '') {\n\t\thtml = html.concat(`<p><strong>Sent from:</strong><a href='${host}'> ${host}</a></p>`);\n\t}\n\thtml = html.concat(`\n\t\t\t<p><strong>Visitor name:</strong> ${name}</p>\n\t\t\t<p><strong>Visitor email:</strong> ${email}</p>\n\t\t\t<p><strong>Message:</strong><br>${emailMessage}</p>`);","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/omnichannel/messages.ts#L13-L49","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable `Livechat_display_offline_form` in the admin settings if the offline form is wanted","Otherwise stop calling sendOfflineMessage and hide the offline form in the widget; check the setting first","In integrations, read the public livechat config (it exposes offline-form availability) before attempting submission"],"exampleFix":"// before\nawait sendOfflineMessage(data);\n\n// after\nif (!settings.get('Livechat_display_offline_form')) {\n  return showChatClosedMessage();\n}\nawait sendOfflineMessage(data);","handlingStrategy":"validation","validationCode":"if (!settings.get('Livechat_display_offline_form')) {\n  return showUnavailableMessage();\n}\nawait sendOfflineMessage(data);","typeGuard":"const offlineFormEnabled = (): boolean =>\n  settings.get<boolean>('Livechat_display_offline_form') === true;","tryCatchPattern":"try {\n  await sendOfflineMessage(data);\n} catch (e) {\n  if (e instanceof Error && e.message === 'error-offline-form-disabled') {\n    // hide the form; feature switched off server-side\n  }\n}","preventionTips":["Read livechat public config to decide whether to render the offline form","Re-check the setting when the widget reloads, not once at build time","Return a friendly 'chat unavailable' state instead of surfacing the error"],"tags":["omnichannel","offline-form","settings","livechat","email"],"backgroundTag":"feature-disabled-by-config","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}