Entry can not contain both gd:when and gd:rec

Eric Brown
  • Eric Brown
    Eric Brown

    Just set up GCALSync and get this error for many appointments set up in iCal 2.0.5.
    "Entry can not contain both gd:when and gd:recurrence elements"

    I'm running OS X 10.4.11.

    Any thoughts on how to fix this?


    • dikkydik

      I have exactly the same message.
      It only pops up on recurring events.

      Running on Windows 7 with java version "1.6.0_15", Java(TM) SE Runtime Environment (build 1.6.0_15-b03), Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)

      Hope anyone does have an idea how to fix this.

  • Charles

    I too am getting this message when syncing with Sunbird 0.9. It happens only when the recurring event is created using Sunbird. Creating the recurring event on my phone or directly with Google Calendar avoids the problem

    I am running GCalDaemon 1.0 beta 16 on XP in offline mode.

  • D.L.

    Hi there!

    I was running into the same problem.
    So I've looked through the code and wrote a small patch in order to avoid this problem. Apply the following patch to GCalUtilities.java in the core directory (of the source of course) and your new application will be able to handle repeating events.

        -- GCalUtilities.java  2008-02-02 23:10:34.000000000 +0100
        +++ GCalUtilities_new.java      2009-10-06 23:46:02.000000000 +0200
        @@ -1212,10 +1212,19 @@
                        // Set when
        -               When startAndEnd = new When();
        -               startAndEnd.setStartTime(toDateTime(startDate));
        -               startAndEnd.setEndTime(toDateTime(endDate));
        -               entry.addTime(startAndEnd);
        +               boolean skipWhen = false;
        +               if (start != null && end != null) {
        +                       Property rRule = event.getProperty(Property.RRULE);
        +                       if (rRule != null) {
        +                               skipWhen = true;
        +                       }
        +               }
        +               if (!skipWhen) {
        +                       When startAndEnd = new When();
        +                       startAndEnd.setStartTime(toDateTime(startDate));
        +                       startAndEnd.setEndTime(toDateTime(endDate));
        +                       entry.addTime(startAndEnd);
        +               }
                        // Convert location to where
                        Location location = event.getLocation();

    Hope this helps…

  • D.L.

    I just wanted to add: I didn't spend too much time on it - I just wanted to get some working patch. So I really don't know if there might be some problems with this patch in some constellations.

    I will do a little bit of testing right now - you are encouraged to do so, too.

  • rondoe

    winequarter, I applied your patch to GCalUtilities.java, but the problem remains as before. Is there any update to your patch in the meantime or some other solution?

  • rondoe

    I am currently still working on getting my events from my std.ics from KOrganizer into Google Calendar. As a workaround for the "Entry can not contain both gd:when and gd:recurrence elements" problem, I filtered recurring events from the std.ics file into another file and imported that file via the Google calendar settings. This works besides that events imported via calendar settings have a duration of at least one hour, no matter what starting and ending time they really have set.

    Here's how I filtered the recurring events:

    At first I split the std.ics into a separate file for each event (note that the BEGIN:VCALENDAR and END:VCALENDAR stuff also goes into a separate file, but that doesn't matter for our purpose), the files are named event-.ics (I'm not an awk expert ;-)), event-0.ics to event-XXXX.ics:
    $ awk '/BEGIN:VEVENT/{n++}{print > "event-" n ".ics"}' std.ics

    Then I collected all recurring event files into one file for import in the calendar settings:
    $ cat $(grep -l RRULE event-*.ics) > recurrence.ics

  • rondoe

    My commands given above didn't create a file which is completely importable. Here is the updated complete version:

    awk '/BEGIN:VEVENT/{n++}{print > "event-" sprintf("%04d", n) ".ics"}' std.ics<br />
    rm event-0000.ics # remove BEGIN:VCALENDAR file<br />
    sed -i 's/END:VCALENDAR//g' $(ls event-*.ics|tail -n1) # remove END:VCALENDAR from last event file<br />
    echo "BEGIN:VCALENDAR" > recurrence.ics<br />
    cat $(grep -l RRULE event-*.ics) >> recurrence.ics # collect recurring events<br />
    echo "END:VCALENDAR" >> recurrence.ics

  • D.L.

    Hi Rondoe!

    I used the patch above without any further modification. It worked for me and there were no problems with the import of recurrend events any more.

    But at this moment, I don't use GCalDaemon any more. So probably anything else has been changed in the meantime.

  • rondoe

    Hey winequarter,

    so you didn't need to recompile GCalUtilities.java into a .jar file or something? If you did, how did you do it or where could I find info on that?

    Have you found a different solution than GCALDaemon or why don't you use it anymore?

  • D.L.

    Hi again!

    No, I had to recompile the whole application into a new JAR archive. I hope that you are able to to this on your own - I've deleted the sources from my harddisk, since I do not need it anymore. But if your build-process does not work, I will try to reconstruct the environment and give you the necessary hints.

    My solution now is, that I don't use the GoogleCalendar. I'm syncing the files of different computers directly - without Google webinterface.

  • Peter Aikins
    Peter Aikins

    Excuse my newbie question, but can someone explain how to go about implementing the patch winequarter suggests? How does one compile the code in order to make a working app?


  • Anonymous

    Hello i'm running exactly the same problem. My config is Zimbra to Google via GcalDaemon.

    I'm joining pjaikins to ask for someone who can explains how to apply the patch proposed by winequarter.

    I've got a lot of recursive events and for me it's really a problem.

    Thank you

    Sorry for my English, it's not my natural language.


  • Anonymous

    get the same Problem with sync ical to google:

    Thats one of the events which cause the problem:

    ORGANIZER;CN="N W":MAILTO:n.w@company.de
    SUMMARY;CHARSET=UTF-8:Interne Schulung (Serientermin)
    LOCATION;CHARSET=UTF-8:Company-Solutions GmbH,
    67000 Town


  • Anonymous

    I've compiled winequarter's patch and it 1.0b16 now works perfectly to sync my recurring Rainlendar events to Google Calender. If you're using the category field in Rainlender be sure to enable "extended sync" in the configuration options.
    I've provided just the patched jar file here:
    just replace the gcal-daemon.jar file in the \lib directory with this one. If you're running the service you will need to stop it to be able to replace the file.


  • Anonymous

    I tried the fix. It works well. Thank you.

    I did the following tests:
    - create a recurring event in Lightning and sync to Google calendar: -- OK
    - create a recurring event in Google calendar and sync to Lightning. -- OK
    - delete one instance of the recurring event in Lightning and sync to Google Calendar. -- OK
    - delete one instance of the recurring event in Google Calendar and sync to Lightning. -- OK