18 Feb, 2008
How to fix iWork 08/Keynote/iDvd/Numbers/Pages NSInternalInconsistencyException crash
Some time after installing Leopard OS X 10.5 and second set of updats for iWork 08 the Keynote Application started crashing on start. Crash report said the following:
Process: Keynote 
Path: /Applications/iWork '08/Keynote.app/Contents/MacOS/Keynote
Version: 4.0 (591)
Build Info: Keynote-5910000~3
Code Type: X86 (Native)
Parent Process: launchd 
Date/Time: 2008-02-17 15:32:34.960 +0000
OS Version: Mac OS X 10.5.2 (9C31)
Report Version: 6
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: (index >= 0) && (index < (_itemArray ? CFArrayGetCount((CFArrayRef)_itemArray) : 0))'
After much fiddling around I found a hint that this might be due to duplicated fonts that confuses Keynote so much on startup that it crashes.
Here is a quicke guide how to check if you have duplicated fonts on OS X:
First: Open Font Book (Applications -> Font Book)
Once you have Font Book open, check for any fonts that have black dots next to the name. This means that you have duplicates of this font installed. In my case I had a few dozens of duplicates on the system.
You can then either manually turn off conflicting fonts or choose Resolve Duplicates from Edit menu. This will automatically disable one of the fonts in duplicate fonts pairs. You can always turn them on later if you decide that you need the other font from the duplicated pair.
Second: Clear your Font Cache
Download neat little utility called Font Nuke (it’s free). After you run it, first Update Cache List and then Nuke Font Caches. After OS X reboot your system will automatically rebuild the font cache.
At this point, you can try running Keynote or any other crashing application again and it should work as in good old Tiger days.
Why did this happen?
Taking a minute to think of the scenario that created environment for this crash. When I installed Leopard I updated my Tiger installation which it seems to transfer some fonts and thus create duplicates. This does not seem to affect any applications normally so you can survive a long time before you run the Keynote for first time and it crashes. It is also possible that these fonts are stored in your user profile, because of that Keynote will not crash if you create a new user and try running it from there.
Online forums recommend full OS X reinstall in somewhat Windows-horror story like scenario. Realizing that this will effectively clean up your font resource explains why this would work.