In the last couple of days I noticed a redundant error message appearing in my mac’s console log:
CalendarAgent: AOSKit ERROR: (-) RAF: Invalid url -- https://<username>%firstname.lastname@example.org/calendar/dav/<username>%40gmail.com/
The error happens each time iCal syncs.
I found out I need to create the calDAV account from within the Calendar Application instead of system preferences or it won’t work.
This must be an OSX implementation error that forces the username to be suffixed with @gmail.com when you register a gmail account through System Preferences > Mail, Contacts & Calendars.
If you use System Preferences > Mail, Contacts & Calendars to add your gmail account, and enable Mail, Calendar & Reminders, Messages and Notes, your caldav account for calendar will be set up with a username like <username>@gmail.com, originating a caldav url like:
This is an invalid url, as google is expecting only your username and not username and domain.
If you delete your GMAIL account from Mail, Contacts & Calendar and go to Calendars > preferences > accounts and choose add an account, choosing account type calDAV and entering only your user name (without domain), password and your calDAV URL in the below format; your account will setup correctly and no errors will appear on console log.
Furthermore, if you wish to re-enable mail, Messages and Notes, just head up to System Preferences > Mail, Contacts & Calendars, choose your recently created gmail account and enable those checkboxes.
This solved my 100+ error messages per day on console log for CalendarAgent.
If you have multiple calendars on the same account, go to https://www.google.com/calendar/syncselect and select those that you want to show on calendar.
Hope this helps whomever found out about this and want to fix it, and even those who have not yet detected this issue.