RocketChat/Rocket.Chat · warning · Error

invalid-chart-name

invalid-chart-name

Error message

invalid-chart-name

What it means

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.

Source

Thrown at apps/meteor/server/api/v1/omnichannel/statistics.ts:20

import { isLivechatAnalyticsAgentOverviewProps, isLivechatAnalyticsOverviewProps } from '@rocket.chat/rest-typings';

import { API } from '../..';
import { getAgentOverviewDataCached, getAnalyticsOverviewDataCached } from '../../../lib/omnichannel/AnalyticsTyped';
import { settings } from '../../../settings';

API.v1.addRoute(
	'livechat/analytics/agent-overview',
	{
		authRequired: true,
		permissionsRequired: ['view-livechat-manager'],
		validateParams: isLivechatAnalyticsAgentOverviewProps,
	},
	{
		async get() {
			const { name, departmentId, from, to } = this.queryParams;

			if (!name) {
				throw new Error('invalid-chart-name');
			}

			const user = await Users.findOneById(this.userId, { projection: { _id: 1, utcOffset: 1 } });
			return API.v1.success(
				await getAgentOverviewDataCached({
					departmentId,
					utcOffset: user?.utcOffset || 0,
					daterange: { from, to },
					chartOptions: { name },
					executedBy: this.userId,
				}),
			);
		},
	},
);

API.v1.addRoute(
	'livechat/analytics/overview',

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Always include a non-empty `name` query param matching one of the supported agent-overview chart names.
  2. Fetch the list of available chart names first and disable the request until one is selected.
  3. After an upgrade, reconcile client chart identifiers with the server's supported list.

Example fix

// before
GET('/api/v1/livechat/analytics/agent-overview', { departmentId, from, to });

// after
if (!chartName) throw new ClientError('Select a chart');
GET('/api/v1/livechat/analytics/agent-overview', { name: chartName, departmentId, from, to });
Defensive patterns

Strategy: validation

Validate before calling

if (!chartName || typeof chartName !== 'string') throw new ClientError('chart-name-required');
await GET('/api/v1/livechat/analytics/agent-overview', { name: chartName, departmentId, from, to });

Type guard

const isChartName = (n: unknown): n is string => typeof n === 'string' && n.length > 0 && ALLOWED_AGENT_CHARTS.includes(n);

Try / catch

try {
  await GET('/api/v1/livechat/analytics/agent-overview', { name: chartName, ... });
} catch (e) {
  if (e.message === 'invalid-chart-name') { disableWidgetUntilChartSelected(); return; }
  throw e;
}

Prevention

When it happens

Trigger: GET livechat/analytics/agent-overview?departmentId=...&from=...&to=... without the `name` query param, or with name=''.

Common situations: 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.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/65d88119a3bdcb8f. Report an issue: GitHub.