{"record":{"id":"f2bfa77e4dae72c0","repo":"RocketChat/Rocket.Chat","slug":"invalid-livechat-config","errorCode":null,"errorMessage":"invalid-livechat-config","messagePattern":"invalid-livechat-config","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/server/api/v1/omnichannel/room.ts","lineNumber":261,"sourceCode":"\t'livechat/room.survey',\n\t{ validateParams: isPOSTLivechatRoomSurveyParams },\n\t{\n\t\tasync post() {\n\t\t\tconst { rid, token, data } = this.bodyParams;\n\n\t\t\tconst visitor = await findGuest(token);\n\t\t\tif (!visitor) {\n\t\t\t\tthrow new Error('invalid-token');\n\t\t\t}\n\n\t\t\tconst room = await findRoom(token, rid);\n\t\t\tif (!room) {\n\t\t\t\tthrow new Error('invalid-room');\n\t\t\t}\n\n\t\t\tconst config = await settings();\n\t\t\tif (!config.survey?.items || !config.survey.values) {\n\t\t\t\tthrow new Error('invalid-livechat-config');\n\t\t\t}\n\n\t\t\tconst updateData: { [k: string]: string } = {};\n\t\t\tfor (const item of data) {\n\t\t\t\tif ((config.survey.items.includes(item.name) && config.survey.values.includes(item.value)) || item.name === 'additionalFeedback') {\n\t\t\t\t\tupdateData[item.name] = item.value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (Object.keys(updateData).length === 0) {\n\t\t\t\tthrow new Error('invalid-data');\n\t\t\t}\n\n\t\t\tif (!(await LivechatRooms.updateSurveyFeedbackById(room._id, updateData))) {\n\t\t\t\treturn API.v1.failure();\n\t\t\t}\n\n\t\t\treturn API.v1.success({ rid, data: updateData });","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/api/v1/omnichannel/room.ts#L243-L279","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Configure the survey in the admin UI: Administration -> Omnichannel -> Survey (define the rating items and their allowed values), then retry","Check the configuration the visitor-facing stack actually sees: GET /api/v1/livechat/config and confirm the survey object has both items and values","If settings were migrated, inspect/repair the Livechat survey settings in the database or re-save them from the admin UI"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const cfg = await (await fetch(`${url}/api/v1/livechat/config`)).json();\nconst surveyReady = Array.isArray(cfg?.survey?.items) && Array.isArray(cfg?.survey?.values) && cfg.survey.items.length > 0;\nif (!surveyReady) skipSurveyScreen(); // config missing server-side","typeGuard":"function hasSurveyConfig(cfg) {\n  return Array.isArray(cfg?.survey?.items) && Array.isArray(cfg?.survey?.values);\n}","tryCatchPattern":"try { await postSurvey(rid, token, data); } catch (e) { if (e.message === 'invalid-livechat-config') { logServerConfigGap(); return; } throw e; }","preventionTips":["Configure the omnichannel survey on the server before shipping survey UI","Feature-detect the survey from livechat/config instead of assuming it exists","Alert admins when the survey screen is unreachable due to server config"],"tags":["omnichannel","livechat","survey","server-config","rest-api"],"backgroundTag":"missing-configuration","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}