Adding a calendar event of the same date twice produced an error. The problem was the xf_calendar table had the thread_id field as a primary where it should have been made an index.