RocketChat/Rocket.Chat · error · Error

invalid-livechat-config

Error message

invalid-livechat-config

What it means

Thrown by POST /api/v1/livechat/room.survey when the livechat configuration returned by settings() lacks survey.items or survey.values. The server-side survey definition is absent or incomplete, so no feedback can be validated or stored. It is a server configuration problem, not a bad request payload.

Solutions

  1. Configure the survey in the admin UI: Administration -> Omnichannel -> Survey (define the rating items and their allowed values), then retry
  2. Check the configuration the visitor-facing stack actually sees: GET /api/v1/livechat/config and confirm the survey object has both items and values
  3. If settings were migrated, inspect/repair the Livechat survey settings in the database or re-save them from the admin UI
Defensive patterns

Strategy: validation

Validate before calling

const cfg = await (await fetch(`${url}/api/v1/livechat/config`)).json();
const surveyReady = Array.isArray(cfg?.survey?.items) && Array.isArray(cfg?.survey?.values) && cfg.survey.items.length > 0;
if (!surveyReady) skipSurveyScreen(); // config missing server-side

Type guard

function hasSurveyConfig(cfg) {
  return Array.isArray(cfg?.survey?.items) && Array.isArray(cfg?.survey?.values);
}

Try / catch

try { await postSurvey(rid, token, data); } catch (e) { if (e.message === 'invalid-livechat-config') { logServerConfigGap(); return; } throw e; }

Prevention

When it happens

Trigger: Calling livechat/room.survey on an instance where the omnichannel survey has never been configured, where survey items exist but the values array is missing (partial/migrated settings), or where the settings service failed to expose them to this endpoint.

Common situations: Fresh installs or test environments that never set up the post-chat survey; upgrades/migrations that dropped the legacy survey settings; custom deployments where only some Omnichannel settings were imported.

Related errors


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

Appendix: source

Thrown at apps/meteor/server/api/v1/omnichannel/room.ts:261

	'livechat/room.survey',
	{ validateParams: isPOSTLivechatRoomSurveyParams },
	{
		async post() {
			const { rid, token, data } = this.bodyParams;

			const visitor = await findGuest(token);
			if (!visitor) {
				throw new Error('invalid-token');
			}

			const room = await findRoom(token, rid);
			if (!room) {
				throw new Error('invalid-room');
			}

			const config = await settings();
			if (!config.survey?.items || !config.survey.values) {
				throw new Error('invalid-livechat-config');
			}

			const updateData: { [k: string]: string } = {};
			for (const item of data) {
				if ((config.survey.items.includes(item.name) && config.survey.values.includes(item.value)) || item.name === 'additionalFeedback') {
					updateData[item.name] = item.value;
				}
			}

			if (Object.keys(updateData).length === 0) {
				throw new Error('invalid-data');
			}

			if (!(await LivechatRooms.updateSurveyFeedbackById(room._id, updateData))) {
				return API.v1.failure();
			}

			return API.v1.success({ rid, data: updateData });

View on GitHub (pinned to b2c16d5842)