Broken events in ownCloud calendar

owncloud-square-logoSuddenly the synchronization with the ownCloud calendar stopped working. It gave me a strange message in the logs:

{“reqId”:”epU4rqrz1maFuP9hBxmu”,”remoteAddr”:”127.0.0.1″,”app”:”calendar”,”message”:”Event (20150807T141714Z-27435_7a94261e27f2b60.ics) contains invalid data: End of document reached prematurely”,”level”:2,”time”:”2015-09-03T06:00:26+00:00″}

The interesting part here is the error message that says “Event contains invalid data: End of document reached prematurely”. Looking around I found out that there are some reports of broken VCalendar events stored in the database. So, using the mighty SQL statement

mysql -u owncloud -p ownclouddb -e “SELECT * FROM oc_clndr_objects WHERE calendardata NOT LIKE ‘%END:VCALENDAR%’;”

I found that the database contains 218 events without a closing END:VCALENDAR statement. All of the events were for the same event that I created recently mercilessly duplicated. And the event was not showing on the calendar, of course.

As soon as I deleted all of those broken entries from the database, everything came back to normal. Sync works again. My guess for the reason? Graphical smileys in the title. Try to stick to the pure ASCII there next time, I guess.

5 thoughts on “Broken events in ownCloud calendar

  1. THANK YOU!!!
    I have been fighting with a broken calendar for months now. I thought it was connected to an upgrade to owncloud 8, or a missing file (I kept getting a file not found, when I tried to export my calendar) etc.
    And then the solution was so simple…
    Thanks again.

  2. Thank you too! Was actually considering other options (Baikal, caldavd, etc) before I looked into this odd “End of document” error. That SQL statement pinpointed the corrupt calendar events perfectly.

  3. Thanks for posting this error. I was really confused as to what happend to my calender ;). Questions is if it is an Davdroid bug (thats the client i used) or an owncloud problem.

  4. Thanks! Had this problem, probably because of a smiley in the title of a todo item. Couldn’t find a solution – until now :-)

Leave a Reply

Your email address will not be published. Required fields are marked *