Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was tailing /var/log/system.log and noticed a sudden wall of text. Looking closer, I saw it was an error CalendarAgent got while trying to save something:

Nov 18 11:42:45 rainbow-dash.local CalendarAgent[12321]: CoreData: error: (11) Fatal error.  The database at /Users/blackl/Library/Calendars/Calendar Cache is corrupted.  SQLite error code:11, 'database disk image is malformed'
Nov 18 11:42:45 rainbow-dash.local CalendarAgent[12321]: Core Data: annotation: -executeRequest: encountered exception = Fatal error.  The database at /Users/blackl/Library/Calendars/Calendar Cache is corrupted.  SQLite error code:11, 'database disk image is malformed' with userInfo = {
        NSFilePath = "/Users/blackl/Library/Calendars/Calendar Cache";
        NSSQLiteErrorDomain = 11;

2 messages repeated several times

Nov 18 11:42:49 rainbow-dash.local CalendarAgent[12321]: [] [WARNING: CalSubscriptionSession :: persistError :: save failed]

This entire sequence is repeated many times throughout the log.

file said the file in question was a SQLite 3.x database, so I did a bit of searching and came up with a way to check those.

blackl% cp -i ~/Library/Calendars/Calendar\ Cache /tmp
blackl% sqlite3 /tmp/Calendar\ Cache
SQLite version 3.7.12 2012-04-03 19:43:07
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> pragma integrity_check ;
*** in database main ***
Main freelist: Bad ptr map entry key=863 expected=(2,0) got=(5,21)
On page 21 at right child: 2nd reference to page 863

This is followed by a few dozen lines like these:

rowid <number> missing from index <name>

and then:

wrong # of entries in index <name>

I'm at a bit of a loss as to what to do now—I couldn't find anything on how to fix the errors that I found. Also, it would probably be a good idea to disable Calendar Agent so it doesn't try to use the database while it's being fixed (that's why I copied it to /tmp before running sqlite3 on it.)

How do I disable CalendarAgent and fix its cache?

share|improve this question
up vote 1 down vote accepted

I had the same problem, so I closed Calendar and moved the Calendar Cache file away.

Then I opened Calendar. It took a minute or so "Upgrading calendars..." but then it all came up just fine.

share|improve this answer
Simple solution, but it seems to have worked. Looks like this was just me overcomplicating things again! XD – Blacklight Shining Dec 15 '12 at 15:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.