mantinedev/mantine · error · Error
[@mantine/schedule] AgendaView: Duplicated event ids found:
Error message
[@mantine/schedule] AgendaView: Duplicated event ids found: ${event.id} What it means
The Schedule component's AgendaView validates that each event has a unique id within the provided events array. When the same event id is encountered twice while grouping events by date, this error is thrown during render, because duplicate ids break event positioning, resizing and editing.
Source
Thrown at packages/@mantine/schedule/src/components/AgendaView/get-agenda-view-events.ts:82
const end = dayjs(rangeEnd).startOf('day');
const ids = new Set<string | number>();
for (const event of events) {
if (event.display === 'background') {
continue;
}
const eventStart = dayjs(event.start).startOf('day');
const eventEnd = dayjs(event.end).startOf('day');
if (eventEnd.isBefore(start) || eventStart.isAfter(end)) {
continue;
}
if (!ids.has(event.id)) {
ids.add(event.id);
} else {
throw new Error(`[@mantine/schedule] AgendaView: Duplicated event ids found: ${event.id}`);
}
groupEventByDate(validateEvent(event), groupedEvents, start, end);
}
return groupedEvents;
}
View on GitHub (pinned to 8a284e2c2c)
Solutions
- Deduplicate events by id before passing to Schedule: events.filter((e, i, a) => a.findIndex((x) => x.id === e.id) === i)
- Fix the data source/query that produces duplicate records
- Ensure multi-day events are passed once with start/end spanning days, not repeated per day
Example fix
// before const events = [...googleEvents, ...outlookEvents]; // overlapping ids // after const events = [...new Map([...googleEvents, ...outlookEvents].map((e) => [e.id, e])).values()];
Defensive patterns
Strategy: validation
Validate before calling
const dedupeEvents = (events) =>
[...new Map(events.map((e) => [e.id, e])).values()];
<Schedule events={dedupeEvents(rawEvents)} />; Type guard
function hasUniqueEventIds(events: { id: string | number }[]): boolean {
return new Set(events.map((e) => e.id)).size === events.length;
} Prevention
- Deduplicate merged calendar feeds by id before rendering
- Assign unique ids when splitting multi-day events
- Add a data-layer test asserting event id uniqueness
When it happens
Trigger: Passing events where two objects share the same id property; the same event object referenced twice in the array; multi-day events duplicated per day by a data transform.
Common situations: Fetching events from multiple calendar sources and concatenating arrays with overlapping ids; backend returning duplicated records; a spread/copy bug re-adding an event to the list.
Related errors
- [@mantine/schedule] DayView: Duplicated event ids found: ${e
- [@mantine/schedule] MobileMonthView: Duplicated event ids fo
- [@mantine/schedule] MonthView: Duplicated event ids found: $
- [@mantine/schedule] ResourcesDayView: Duplicated event ids f
- [@mantine/schedule] ResourcesWeekView: Duplicated event ids
AI-assisted analysis of mantinedev/mantine@8a284e2c2c (2026-08-28).
Data as JSON: /api/errors/a9aae55bf8ca2be9.
Report an issue: GitHub.