mantinedev/mantine · error · Error

[@mantine/schedule] YearView: Duplicated event ids found: ${

Error message

[@mantine/schedule] YearView: Duplicated event ids found: ${event.id}

What it means

Thrown by getYearViewEvents in @mantine/schedule when the events array contains two events with identical ids. YearView groups events per date and uses ids for internal bookkeeping; duplicates would corrupt grouping. Validation happens per event as it is matched to the current year.

Source

Thrown at packages/@mantine/schedule/src/components/YearView/get-year-view-events/get-year-view-events.ts:55

}

export function getYearViewEvents({ date, events }: GetYearViewEventsInput) {
  const groupedEvents: GroupedEvents = {};

  if (events === undefined) {
    return groupedEvents;
  }

  const ids = new Set<string | number>();

  for (const event of events) {
    if (dayjs(event.start).isSame(dayjs(date), 'year')) {
      groupEventByDate(validateEvent(event), groupedEvents);

      if (!ids.has(event.id)) {
        ids.add(event.id);
      } else {
        throw new Error(`[@mantine/schedule] YearView: Duplicated event ids found: ${event.id}`);
      }
    }
  }

  return groupedEvents;
}

View on GitHub (pinned to 8a284e2c2c)

Solutions

  1. De-duplicate by id before passing events to YearView
  2. Regenerate ids when cloning or importing events
  3. Check the data layer for double-fetched or double-appended events

Example fix

// before
<YearView events={allEvents} /> // allEvents has duplicate ids

// after
const deduped = [...new Map(allEvents.map((e) => [e.id, e])).values()];
<YearView events={deduped} />
Defensive patterns

Strategy: validation

Validate before calling

const deduped = [...new Map(events.map((e) => [e.id, e])).values()];
// pass deduped to YearView

Type guard

const hasUniqueEventIds = (events: ScheduleEventData[]): boolean =>
  new Set(events.map((e) => e.id)).size === events.length;

Prevention

When it happens

Trigger: Passing an events array with duplicate ids to YearView; note the error only fires for duplicates among events whose start date falls within the rendered year.

Common situations: Combining events from multiple API endpoints, dragging/copying an event without assigning a new id, or a store bug that appends an event twice during optimistic updates.

Related errors


AI-assisted analysis of mantinedev/mantine@8a284e2c2c (2026-08-28). Data as JSON: /api/errors/8209f59a216d36d7. Report an issue: GitHub.