Rebuilding iPhoto library causes issues with iTunes photo sync
Solution 1:
Hopefully you have the run of the mill, the iPod Photo Cache is now stale issue which is easily remedied.
- iTunes: Understanding the iPod Photo Cache folder - TS1314
Since you are on Mountain Lion, this is just a folder in the "iPhoto Library" and you can right click on it, and show package contents. Just drag that folder to trash and then quit both iPhoto (and Aperture if you have it) as well as iTunes.
A re-launch of iTunes should see that the folder is missing and clear any sync tokens, and proceed to rebuild a list of pictures, albums and events. Usually, there isn't a second step needed as this folder is designed to be safe to delete at any time to save space on a drive and exists to speed up syncing.
As always, kicking off a backup when looking into deleting things is never a bad idea in case the corruption is deeper than expected or just a sign of a failing storage device.
Solution 2:
Ah, geez. Trust me to forget all about my own question until a year later (and then some).
I never found a way to fix my existing library, so I had planned to start from scratch by exporting all photos from my existing library, creating a new library, and importing and rebuilding everything by hand. Unfortunately, I never had a chance to do that either (yes, not in a whole year; don't ask).
Today, while preparing for an upgrade to my Mac, I decided to take a look at the problematic library again. Since a new version of iPhoto has been released coinciding with the release of OS X 10.9 Mavericks, I let it upgrade my library. So far, so good — the library opens and I can still see all my photos and metadata.
So I opened iTunes, connected my iPhone, and tried syncing the iPhoto library to it. After a few experiments... it looks like the syncing problem I described has vanished completely. Everything syncs properly now. iTunes reports all the correct numbers. And my iPhone doesn't get wiped on every subsequent connect-and-sync either.
I wish I could find out what exactly the upgrade process did to fix things so I could at least understand what the problem was and provide a much more useful answer. For now, I suppose all I can say is to wait and see if a library upgrade with an updated version of iPhoto works.
One thing's for sure, though: I'm not rebuilding my photo library from scratch anymore.