Search code examples
google-calendar-apiicalendar

In what situations could an iCal VEVENT end up with a duplicated UID?


I can't seem to figure out why these Google iCal events have a few non-unique UIDs. The spec says that event UIDs "MUST" be unique, but Google Calendar is returning a few duplicates.

➜ grep 'UID:' testcal.ics | wc -l
744

➜ grep 'UID:' testcal.ics | uniq -c
738

➜ grep 'UID:' testcal.ics | uniq -d
UID:[email protected]
UID:[email protected]
UID:[email protected]
UID:[email protected]

testcal.ics is an export of one of my personal calendars which goes back about 10 years. The calendar has hundreds of events of all types. Recurring events that I created, events I was invited to, transparent events, multi-day events, etc. etc. etc.

The four UIDs listed above all correspond to recurring events. For each duplicated UID, there is a "parent" VEVENT which lists the recurring rule and a "child" VEVENT to represent an individual instance in that sequence. In one case, there are two instances and one "parent" which all share the same UID.

They don't seem to have any correlation beyond the fact that they are all recurring events. They have >=1 instances in the recurrence which did get a unique UID. Likewise, there are hundreds of other recurring events which are not affected by this. These four happened at very different times (2013, 2015, 2018 and 2020), so the device/app managing them would have been very different each time.

Is this just a persistent bug or is there a legitimate situation where duplicate UIDs might be appropriate (even if it isn't in the spec)?


Solution

  • It is legitimate to have multiple VEVENT with the same UID in a calendar stream. One is the master recurring event (it has either RRUle or RDATE properties), while the other ones have a RECURRENCE-ID and do corresponds to instances of the recurring event for which a change was made only to that instance (e.g. change of LOCATION).

    See for example https://www.rfc-editor.org/rfc/rfc5546#section-4.4.8