{"record":{"id":"65d88119a3bdcb8f","repo":"RocketChat/Rocket.Chat","slug":"invalid-chart-name","errorCode":"invalid-chart-name","errorMessage":"invalid-chart-name","messagePattern":"invalid-chart-name","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"warning","filePath":"apps/meteor/server/api/v1/omnichannel/statistics.ts","lineNumber":20,"sourceCode":"import { isLivechatAnalyticsAgentOverviewProps, isLivechatAnalyticsOverviewProps } from '@rocket.chat/rest-typings';\n\nimport { API } from '../..';\nimport { getAgentOverviewDataCached, getAnalyticsOverviewDataCached } from '../../../lib/omnichannel/AnalyticsTyped';\nimport { settings } from '../../../settings';\n\nAPI.v1.addRoute(\n\t'livechat/analytics/agent-overview',\n\t{\n\t\tauthRequired: true,\n\t\tpermissionsRequired: ['view-livechat-manager'],\n\t\tvalidateParams: isLivechatAnalyticsAgentOverviewProps,\n\t},\n\t{\n\t\tasync get() {\n\t\t\tconst { name, departmentId, from, to } = this.queryParams;\n\n\t\t\tif (!name) {\n\t\t\t\tthrow new Error('invalid-chart-name');\n\t\t\t}\n\n\t\t\tconst user = await Users.findOneById(this.userId, { projection: { _id: 1, utcOffset: 1 } });\n\t\t\treturn API.v1.success(\n\t\t\t\tawait getAgentOverviewDataCached({\n\t\t\t\t\tdepartmentId,\n\t\t\t\t\tutcOffset: user?.utcOffset || 0,\n\t\t\t\t\tdaterange: { from, to },\n\t\t\t\t\tchartOptions: { name },\n\t\t\t\t\texecutedBy: this.userId,\n\t\t\t\t}),\n\t\t\t);\n\t\t},\n\t},\n);\n\nAPI.v1.addRoute(\n\t'livechat/analytics/overview',","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/omnichannel/statistics.ts#L2-L38","documentation":"Thrown by GET livechat/analytics/agent-overview when the `name` query parameter is empty/undefined. The `name` selects which chart (e.g. 'Avg_response_time', 'Chats') the agent-overview dataset returns; without it the analytics helper cannot resolve a series, so the handler rejects the request early.","triggerScenarios":"GET livechat/analytics/agent-overview?departmentId=...&from=...&to=... without the `name` query param, or with name=''.","commonSituations":"Frontend chart selector not initialized before the fetch; the chart name list (livechat/analytics available charts) changed in an upgrade and the client sent the old/blank value; URL builder omits name when no chart is selected.","solutions":["Always include a non-empty `name` query param matching one of the supported agent-overview chart names.","Fetch the list of available chart names first and disable the request until one is selected.","After an upgrade, reconcile client chart identifiers with the server's supported list."],"exampleFix":"// before\nGET('/api/v1/livechat/analytics/agent-overview', { departmentId, from, to });\n\n// after\nif (!chartName) throw new ClientError('Select a chart');\nGET('/api/v1/livechat/analytics/agent-overview', { name: chartName, departmentId, from, to });","handlingStrategy":"validation","validationCode":"if (!chartName || typeof chartName !== 'string') throw new ClientError('chart-name-required');\nawait GET('/api/v1/livechat/analytics/agent-overview', { name: chartName, departmentId, from, to });","typeGuard":"const isChartName = (n: unknown): n is string => typeof n === 'string' && n.length > 0 && ALLOWED_AGENT_CHARTS.includes(n);","tryCatchPattern":"try {\n  await GET('/api/v1/livechat/analytics/agent-overview', { name: chartName, ... });\n} catch (e) {\n  if (e.message === 'invalid-chart-name') { disableWidgetUntilChartSelected(); return; }\n  throw e;\n}","preventionTips":["Load the supported chart-name list before rendering the selector.","Disable the request until a valid chart name is selected.","Re-sync chart identifiers after Rocket.Chat upgrades."],"tags":["omnichannel","livechat","analytics","query-params","validation"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}