RocketChat/Rocket.Chat · warning · Error
Error! fetching chart data.
Error message
Error! fetching chart data.
What it means
Client-side data-integrity check in the omnichannel analytics InterchangeableChart: after loading chart data via loadData (the live/analytics metrics method), it requires both dataLabels and dataPoints to be present; a malformed or empty result throws new Error('Error! fetching chart data.'). The chart only draws when the backend returned a well-formed { chartLabel, dataLabels, dataPoints } object, so this guards against half-empty analytics responses.
Source
Thrown at apps/meteor/client/views/omnichannel/analytics/InterchangeableChart.tsx:85
name: string;
};
departmentId?: string;
}) => {
try {
const tooltipCallbacks = getChartTooltips(chartName);
if (!params?.daterange?.from || !params?.daterange?.to) {
return;
}
const result = await loadData({
chartName,
start,
end,
...(departmentId && { departmentId }),
});
if (!result?.dataLabels || !result?.dataPoints) {
throw new Error('Error! fetching chart data.');
}
(context.current || typeof context.current === 'undefined') &&
canvas.current &&
(context.current = await drawLineChart(
canvas.current,
context.current,
[result.chartLabel],
result.dataLabels,
[result.dataPoints],
{
tooltipCallbacks,
},
));
} catch (error) {
dispatchToastMessage({ type: 'error', message: error });
}
},
);View on GitHub (pinned to b263243745)
Solutions
- Select a date range that actually contains omnichannel conversations.
- Confirm the analytics source (Analytics settings, Conversations/Convo metrics) has data for that period.
- If data exists but charts still fail, inspect the analytics method response shape (dataLabels/dataPoints) for a backend regression.
- As a code-level fix, throw only when the response exists but is malformed, and render an empty-chart state for genuinely empty periods.
Example fix
// before
if (!result?.dataLabels || !result?.dataPoints) {
throw new Error('Error! fetching chart data.');
}
// after: distinguish empty from malformed
if (!result) throw new Error('Error! fetching chart data.');
if (!result.dataLabels?.length && !result.dataPoints?.length) {
return; // render empty-chart placeholder for periods with no data
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!params?.daterange?.from || !params?.daterange?.to) return; // range required // prefer ranges that contain omnichannel traffic on fresh installs
Type guard
const isChartResult = (r: unknown): r is { chartLabel: string; dataLabels: unknown[]; dataPoints: unknown[] } =>
Boolean(r && Array.isArray((r as any).dataLabels) && Array.isArray((r as any).dataPoints)); Try / catch
try { await loadAndDraw(); } catch (e) { if ((e as Error).message === 'Error! fetching chart data.') { /* show 'no data for range' hint */ return; } throw e; } Prevention
- Default analytics ranges to periods with data.
- Validate the metrics response shape in dev builds.
- Distinguish empty periods from malformed responses in chart loaders.
When it happens
Trigger: Opening Omnichannel Analytics with a date range where the queried period has no conversations (empty metrics arrays), or when the analytics method returns an object missing dataLabels/dataPoints; only runs when daterange.from and daterange.to are set.
Common situations: Fresh installs with no omnichannel traffic in the selected range; MongoDB aggregation returning empty labels/points; date-range pickers producing windows outside existing data.
Related errors
- The "start" query parameter must be a valid date.
- The "end" query parameter must be a valid date.
- The "start" and "end" query parameters must be less than 1 y
- The "start" query parameter must be before the "end" query p
- error-invalid-contact
AI-assisted analysis of RocketChat/Rocket.Chat@b263243745 (2026-08-18).
Data as JSON: /api/errors/7748ee126c760a8c.
Report an issue: GitHub.