Friday, January 06, 2006

Strange iSync problem?

I'm getting a wierd iSync error and I'm not sure how to solve it, as you can see the iSync backup conduit thinks I have eight calendars, and the rest of the devices think I have four. The devices that think I have four are right...
07:09:26 Synchronizing calendars and To Do items
07:09:26 Getting all calendars and To Do items from Backup Conduit
07:09:54 calendars: 8 added
07:09:54 events: 1988 added
07:09:54 To Do items: 65 added
07:09:54 Getting all calendars and To Do items from iCal
07:10:22 calendars: 4 added
07:10:22 events: 1988 added
07:10:22 To Do items: 65 added
07:10:22 Getting all calendars and To Do items from .Mac
07:11:01 Error Conduit iCal generated exception NSInvalidArgumentException: *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value. Can't commit folder .
07:11:01 Error Conduit iCal generated exception NSInvalidArgumentException: *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value. Can't commit folder .
07:11:01 Error Conduit iCal generated exception NSInvalidArgumentException: *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value. Can't commit folder .
07:11:01 Error Conduit iCal generated exception NSInvalidArgumentException: *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value. Can't commit folder .

07:11:04 Applying changes to .Mac
07:11:44 calendars: 8 added
07:11:44 events: 1988 added
07:11:44 To Do items: 65 added
07:11:44 Completed synchronizing calendars and To Do items
I'm guessing that this is a hang over from when I had Palm Backup Conduit installed on my Mac, when I did indeed have eight different calendars.

I've tried doing an iSync > Devices > Reset All Devices... but this doesn't seem to have any effect. Presumably because the Backup Conduit has managed to corrupt itself in some weird and wonderful manner previously unknown to science. I've had a look around inside my ~/Library/ folder and have fixed the obvious problems in some of the iCal plist files, but can't find any indication of my iSync still thinks I have the Palm Backup Conduit still around, so my initial guess might be bogus.

Does anyone have any ideas about what's going on here, or where I should be looking to fix things?

Update: Three and a half hours later, we have a solution. If this happens to you take a deep breath, take a backup of your files, and follow the yellow brick road...
  1. First of all you need to remove the bogus calendar files from ~/Library/Calendars/, they're probably going to be called something along the lines of Untitled.ics. Then you need to remove all references to these non-existent calendars...
  2. You'll need to manually edit the com.apple.ical.sources plist file in /Library/Application Support/SyncService/LastSync Data/ removing the dictionary nodes for the bogus calendars under both the RegisteredRepositories and SourcesView nodes. You might want to take a backup of the plist file if you aren't that familiar with the Property List Editor that came with the Apple developer tools bundle.
  3. There will be a number of empty directories in ~/Library/Application Support/iCal/Themes which refer to the non-existent calendars and, while I'm not sure it makes a difference, you should probably remove these as well.
  4. Finally, you're going to have to delete your iSync setup by removing the /Library/Application Support/SyncService/501/ directory along with all its content to get rid of the corrupted backup conduit.
If you have a lot of devices this is going to be a pain because you'll have to reinstall and resync all of them, but I can't find an more elegant solution at this point. Since I don't have the Palm Backup Conduit installed on my Mac I'm not sure what this will do to an existing viable Palm Desktop installation, I'd advise backups at this point.

Of course a lot of the above might be cargo cult fixes, you might just want to try deleting the /Library/Application Support/SyncService/501/ directory and contents right at the start. That might be all that's needed to solve things, but I've got a sneaking suspicion that if you don't at least do (1) then the bogus calendars will get added back into the backup conduit again next time you fire up iSync.

As always, your milage may vary...