How do I fix a corrupt calendar cache?

Posted by Blacklight Shining on Super User See other posts from Super User or by Blacklight Shining
Published on 2012-11-18T21:23:18Z Indexed on 2012/11/18 23:08 UTC
Read the original article Hit count: 467

Filed under:
|
|
|

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]: [com.apple.calendar.store.log.subscription] [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?

© Super User or respective owner

Related posts about osx

Related posts about Corruption

  • help! corrupt file recovery

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    My supervisor computer crashed last night, and I'm trying to help him out. He made an R script but when he tried to open it, it was empty. But for some reason the file is 7.9kb so it should not be empty i think... anyway when i tried to open it, Gedit gave this error: "The file you opened has… >>> More

  • Login screen restarts while entering password

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I am having a problem that only occurred after installing the fglrx proprietary driver through the additional drivers app. The exact same issue is described in this question, however it's closed. Must login twice before entering Unity; first login screen has graphical anomalies When I boot up my… >>> More

  • Delete corrupted folder

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I am trying to delete a folder in my home directory; its name is completely garbled. In Nautilus, the garbled text is followed by 'Invalid Directory.' Deleting it with Nautilus stalls; I can't type in the garbled name in the terminal. peter@io_vbox:~$ ls -lbdR * ... drwxrwxr-x 3 peter peter … >>> More

  • Error while installing netbeans

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I tried to install NetBeans 7.2 from a downloaded .sh file, but experienced problems. Here's text from the Terminal, which shows what I did and what happened: hridesh@ubuntu:~$ cd Desktop/ hridesh@ubuntu:~/Desktop$ cd full\ netbeans\ 7.2\ for\ linux\ in\ .sh\ format/ hridesh@ubuntu:~/Desktop/full… >>> More

  • How do I fix a corrupted harddrive after failed upgrade?

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    The problem originated when I was trying to fix this problem. Things went horribly, horribly wrong and I ended up with a new problem altogether. The last thing I did was run sudo apt-get install and that caused my system to freeze. I restarted my computer and it would not boot from the harddrive… >>> More