8 Replies Latest reply: Jul 19, 2012 9:24 AM by Sydflash
James Bucanek Level 1 (55 points)



I recently upgraded my main MacPro to Lion, which also completed my iCloud transision. I had already converted my MobilMe account to iCloud and upgraded my iPad and iPhone.


However, every morning when I start iCal it puts up an alert that says:


iCal can’t log in to your “iCloud” account because your password may be incorrect.


The server did not recognize your user name or password for account “iCloud.” Make sure you enter them correctly.


When this happens, my iCloud calendars do not sync with my iPad or iPhone.


Now, you'd think there was something wrong with my password, but that's not the case. I can log into iCloud on the website. Lion is logged into iCloud in the System Preferences. I've tried logging out of iCloud and back in. I've tried turning iCloud calendar syncing off and back on, several times.


And it gets stranger. If I quit iCal and immediately relaunch it, it works! There is no dialog, and all calendars immediately sync and stay synced.


I have this feeling that I've got a keychain problem, but I've run the Keychain repair (no problems) and tried deleting all of the keychain items that look like they had anything to do with iCloud, mac.com, or iCal. And yet, every morning I have the same probem.


Does anyone have a clue as to what the problem might be?

  • James Bucanek Level 1 (55 points)

    Here's a little more info.


    This morning, when my iCal opened I get this in the log:

    11/13/11 9:00:02.980 AM iCal: ServerNotifications: Setting delegate to APSD

    11/13/11 9:00:03.000 AM iCal: ServerNotification: configureService called with nil password

    11/13/11 9:00:03.291 AM iCal: AOSKit ERROR: Cannot refresh account bag, missing acct info (user=myaccount@mac.com, hasPassword=0)

    11/13/11 9:00:03.302 AM [0x0-0x19c19c].com.apple.iCal: The operation couldn\u2019t be comple

    11/13/11 9:00:03.302 AM [0x0-0x19c19c].com.apple.iCal: ted. (AOSErrorDomain error 5002.)

    11/13/11 9:00:03.302 AM [0x0-0x19c19c].com.apple.iCal: (null)

    11/13/11 9:00:04.388 AM iCal: Account refresh failed with error: Error Domain=CoreDAVHTTPStatusErrorDomain Code=401 "The operation couldn’t be completed. (CoreDAVHTTPStatusErrorDomain error 401.)" UserInfo=0x7feac81321a0 {CalDAVErrFromRefresh=YES, CoreDAVHTTPHeaders=<CFBasicHash 0x7fead492ee50 [0x7fff7e11ef40]>{type = immutable dict, count = 7,

    entries =>

              0 : Case Insensitive Key: Server = <CFString 0x7fead491d910 [0x7fff7e11ef40]>{contents = "iCloudCalendarServer 1F53"}

              1 : Case Insensitive Key: Content-Type = <CFString 0x7fff7e115b60 [0x7fff7e11ef40]>{contents = "text/html"}

              2 : Case Insensitive Key: X-Responding-Server = <CFString 0x7fead4931df0 [0x7fff7e11ef40]>{contents = "nk11p03me-caldav016 7"}

              3 : Case Insensitive Key: X-Transaction-Id = <CFString 0x7fead491b310 [0x7fff7e11ef40]>{contents = "8c5ef1d2-0e10-11e1-a05d-984be174d6fc"}

              6 : Case Insensitive Key: Date = <CFString 0x7fead494edb0 [0x7fff7e11ef40]>{contents = "Sun, 13 Nov 2011 16:00:03 GMT"}

              9 : Case Insensitive Key: Www-Authenticate = <CFString 0x7fead4e29870 [0x7fff7e11ef40]>{contents = "x-mobileme-authtoken realm="MMCalDav", basic realm="MMCalDav""}

              10 : Case Insensitive Key: Content-Length = <CFString 0x7fead4929160 [0x7fff7e11ef40]>{contents = "141"}


    , AccountName=iCloud}


    So, I did nothing more than quit iCal and launch it again. The second time, this appear in the log:

    11/13/11 9:00:12.041 AM iCal: ServerNotifications: Setting delegate to APSD

    11/13/11 9:00:12.103 AM iCal: ServerNotification: configureService called with nil password

    11/13/11 9:00:12.264 AM iCal: CardDAV Account already configured for myaccount@mac.com at p03-contacts.icloud.com

    11/13/11 9:00:13.528 AM iCal: Subscription request completed

    11/13/11 9:00:13.535 AM iCal: Subscription request completed


    I'm beginning to think this could be a sandboxing issue. I'll investigate further.

  • astralsam Level 1 (0 points)

    Hi James,


    I had the same error message for the last few weeks.

    What worked for me was to disable and relaunch iCloud completely under system preferences.




  • James Bucanek Level 1 (55 points)

    Mea culpa!


    The "problem" turned out to be Lion's new security model. For years I've had iCal set up to start every morning via a simple cron job. The legacy cron tool, however, now seems to have be a bootstrap jail or some other execution environment that doesn't have access to the keychain. Thus, when iCal was launched by cron (even though I was actually going through the /usr/bin/open tool), it couldn't communicate with the keychain. This also explains why quitting iCal and starting it again would fix the problem.


    I switch to using launchd directly by installing a launchd property list in ~/Library/LaunchAgents. Now iCal launches automatically without any problems. If anyone is interested in doing something similar, here's my agent plist file that opens iCal every morning at 9:01:


    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

    <plist version="1.0">
























  • n8nine Level 1 (0 points)

    I am having this problem with a couple of apps... iCal and OmniFocus come to mind right off the bat.


    I have an automator-made script that I run every morning to make sure my MBP is ready to go by the time i get to it.  Worked great in 10.6, but now in Lion these apps have a "could not log in" error as per above every morning.


    Has anyone found a better workaround for this problem than the launchd plist stuff above?  I can't replicate the problem once I've started working on the Mac, everything launched just fine.  Just first thing in the morning.

  • YankeeGiant77 Level 1 (0 points)

    I frequently have the same problem described in this discussion.  I don't use a cron or any other type of script, plist or program that starts iCloud or iCal other then a restart of the system, disabling iCloud in System Preferences and then adding it back, or quitting iCal and then re-starting it.  I have found that quitting iCal and then restarting it by accepting a meeting invitation often works, but not always.   Obviously, these workarounds are not optimal - and should not be necessary. 


    I know my account name and password are correct because I can log into iCloud on the web.  Also, my contacts sync properly through Address Book with all of my devices (mini server, MacBook Air, iPhone, and iPad). 


    Even stranger, I most often experience this problem on the mini server.  It's much less frequent on the MBA. 


    Any other thoughts as to what's happening and how to fix the problem?


    Thanks in advance. 

  • chriswrightaudio Level 1 (0 points)

    This problem occurred to me about 2 weeks ago. iCal is telling me my password is incorrect, however everything else is syncing just fine (Address Book, Photo Stream, Bookmarks etc). Also, everything is syncing correctly under iOS, including Calendar.


    Still waiting to hear back from Apple, they have told me it's probably some kind of software incompatibility. Whatever it is, it's making things very difficult. I don't expect these kinds of problems when using iCloud under iOS and OS X.

  • chriswrightaudio Level 1 (0 points)

    I just managed to solve my particular version of this problem by reinstalling iCal.


    To do this, you need to download an app called Pacifist by CharlesSoft. It's shareware but the unregisted trial is fully functional. You will also need an installer for your current version of OS X. I redownloaded Lion 10.7.4 via the App Store.


    Obviously you should backup any relevant data etc which may be overwritten by reinstalling iCal. I didn't bother as all of my data is in iCloud.


    You need to use Pacifist to open the OS X Installer, it will then present the individual .pgk files which comprise the OS.


    Navigate to 'Contents of Install Mac OS X Lion.app' > 'Contents of EssentialSystemSoftwareGroup' > 'Contents of iCal.pkg'.


    Right-click on this file and select 'Install to Default Location'.


    After doing this, iCal should return to normal functionality.

  • Sydflash Level 1 (0 points)

    I have this problem all the time with iCal and Mail.  Mail is always telling me passwords for gmail accounts are wrong when they are not and iCal randomy decideds my iCloud password is wrong.  I'd love to see a fix.


    Side note: iCal just plain does not work the way it should so this error does not surprise me.  Guess I'll buy the $20 fix??? coming out this month.