iCal corrupt, MobileMe not syncing - a fix

And so it came to pass. On a fresh install of the OS, 10.6.3, I chose the usual MobileMe options, to sync my Bookmarks, Calendars, Notes, and Contacts from the cloud. A few hours later, I noticed that none of my iCal calendars made it down from the cloud. Nada, nothing! There seemed to be nothing wrong with the Calendars, I could view them just fine on my iMac and online on MobileMe.

Exasperated, I did the following things ->

  • Reset Sync Data from the MobileMe preferences
  • Delete all Calendar data from ~/Library/Calendars & ~/Library/Caches/ & ~/Library/Preferences/
  • Cleaned the iCal calendars on my iMac (the one machine which still showed the calendars fine).

What made it all the more disconcerting was the fact that once I deleted the calendars on my iPad, they didn’t restore from MobileMe. I know they were still existent on the MobileMe servers. After racking my skillset for a couple of hours, I did what I should’ve done in the first place. CMD+SPACE and Console. And there it was, the reason for all my troubles.

6/8/10 9:23:38 PM iCalExternalSync[1127] [ICalExternalSync] Refused insert of bad detached event A4BDA98E-488A-4932-BAC4-36CE6526467B that claims to be its own master event
6/8/10 9:23:38 PM com.apple.syncservices.SyncServer[1072] 2010-06-08 21:23:38.747 iCalExternalSync[1127:903] [ICalExternalSync ]Refused insert of bad detached event A4BDA98E-488A-4932-BAC4-36CE6526467B that claims to be its own master event
6/8/10 9:23:38 PM iCalExternalSync[1127] [ICalExternalSync ]Encountered *** -[NSCFSet addObject:]: attempt to insert nil
6/8/10 9:23:38 PM com.apple.syncservices.SyncServer[1072] 2010-06-08 21:23:38.766 iCalExternalSync[1127:903] [ICalExternalSync ]Encountered *** -[NSCFSet addObject:]: attempt to insert nil

The problem seemed to be that there was a corrupt event in the iCal list. An event that claimed to be its own master (think of RDBMS and reference tables). I tried to reset a number of events I had changed in the last few weeks. I tried to look through the Calendar folders to delete the offending event from the disk. But to no avail. So if you find yourself in my shoes, having exhausted all your avenues, here’s a way out.

Google Calendars (GCal). Yes, now read me out. You don’t need to migrate to GCal completely. You will need an amazing piece of software – Spanning Sync, a Google Calendar account, and some courage to take very drastic steps. The process is as follows:-

  1. Create Calendars on GCal that match the calendar categories on your iCal
  2. Download Spanning Sync (fourteen day full trial)
  3. Setup Spanning Sync to sync MobileMe with GCal, but not change anything in iCal
  4. Let her rip and copy everything over to GCal
  5. Now disable syncing on Spanning Sync
  6. Delete every synced computer from MobileMe in the MobileMe preferences (Stop Syncing this Computer)
  7. Also delete all the calendar data when MobileMe asks you (when there are no more computers in the list)
  8. Delete all data from ~/Library/Calendars, ~/Library/Caches/com.apple.iCal, ~/Library/Preferences/com.apple.iCal.plist
  9. Restart
  10. Now open iCal, and you will see it is all reset to factory. Create all new categories (as they once were)
  11. Enable sync back from GCal -> iCal making sure that no changes take place on GCal.
  12. Enable syncing to MobileMe.

GCal will stream back a corrected list of Events into your new categories. Spanning Sync makes sure of that. It is very unfortunate that there is no “non destructive” method of cleaning your Calendar DB once corruption occurs.


Subscribe to Tim Sodhi's musings

Subscribe, or don't. Either way I won't spam you.
[email protected]
Subscribe