iCal corrupt, MobileMe not syncing – a fix

3 minutes

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.


5 thoughts on “iCal corrupt, MobileMe not syncing – a fix

  1. A good tool. Sadly, it won’t be of use much longer – the beta calendar for MobileMe uses a non-writeable CalDav format. As a result, Spanning Sync cannot write the changes back to MobileMe. Hopefully this will get fixed – but it will probably have to happen from Apple’s side. Google’s CalDav format has the same issue (which is why folks need spanning sync, for the most part).

  2. DREADFUL! Apple – please make the iCAL CalDav format writeable. Till changing to the MobileMe beta my secretary could write events into my GCal and they would appear on my Mac, iPhone and iPad iCals suitably sync’d. Now she can’t get stuff from GCal (on the hospital’s PCs) into my Apple computers. HELP please

  3. I’m just starting this process after a giant Calendar going back to 2003 became corrupted. I need all the info in this folder and obviously iCal makes it difficult to isolate the corrupted event(s).

    I was wondering, would it be possible to do all of the above, then send it all back to a new calendar stored on my mac, then copy those events over to a new mobileme calendar? Would this weed out the corruption and allow normal service to continue?

  4. Chris, it should work. I had the same issue as you, where a number of events were causing a calendar not to restore/sync with my other machines. The Spanning Sync route allowed me to reset and restore.

    Make sure to delete on your mac and mobileme (if you use mobileme) once you have copied over all your calendar information via Spanning Sync to your Google Calendar.

    Once you’ve deleted the iCal folder and the calendars on your Mac (as specified above), and restart iCal, two default Calendars will be created – Personal and Work. Create as many Calendars as you like, to mirror your setup as it was.

    When you copy back your calendars from Google Calendar (via Spanning Sync), it will copy back uncorrupted calendar items, thus restoring your iCal calendars to their normal state. Hope this helps.

  5. I have had similar issues since March and eventually got things working again but problems are starting to re-appear. I use this for a small business and now considering running a small server like the Mini so that we can have more control over hosting of iCal, my question is if my problems are due to a corrupt event would we still have the same issues as I believe that the problem may exist on the office iMac which is the master copy.

    Your thoughts on this would be greatly appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.