org-caldav icon indicating copy to clipboard operation
org-caldav copied to clipboard

Fresh sync can't find its own ID(s)

Open jypma opened this issue 3 years ago • 8 comments

I've just done a fresh sync to my NextCloud calendar (~700 entries). Everything came over with no errors, and events have arrived in the "inbox" file, with state written to the "save" file.

However, if I now sync again, the sync always fails with an error message related to the ID of the first event in the inbox file:

org-caldav-generate-md5-for-org-entry: Could not find UID 2016-07-18T19_00_22+0200-29586-1000-1-00000000_jinkpad-20160718T170057Z.

That is literally the ID of the first event in the file.

If I then sync again and select "resume", org-caldav says the sync succeeded, but I'm not sure if everything was updated.

It looks like org-caldav-generate-md5-for-org-entry uses org-id to lookup an org file for an event's UUID; I haven't configured org-id at all, should I?

My current config looks like this

(use-package org-caldav
  :commands (org-caldav-sync)
  :init
  (setq org-caldav-url "https://XXX/remote.php/dav/calendars/jan")
  (setq org-caldav-calendars
        '((:calendar-id "default"
                        :files ("~/.cache/org-caldav/calendars/default.org")
                        :inbox "~/.cache/org-caldav/calendars/default-inbox.org")))
  (setq org-caldav-backup-file "~/.cache/org-caldav/org-caldav-backup.org")
  (setq org-caldav-save-directory "~/.cache/org-caldav/save/")
  :config
  (setq org-icalendar-alarm-time 1)
  (setq org-icalendar-include-todo t)
  (setq org-icalendar-use-deadline '(event-if-todo event-if-not-todo todo-due))
  (setq org-icalendar-use-scheduled '(todo-start event-if-todo event-if-not-todo)))

jypma avatar Mar 14 '21 13:03 jypma

Hello,

I just installed and have a similar/same problem. Two events in testcalendar on my Nextcloud. First sync works fine and events show up in inbox file. Then anytime I try to resync, an error is reported:

2 files scanned, 0 files contains IDs, and 0 IDs found. org-caldav-generate-md5-for-org-entry: Could not find UID 24B640BC-85E6-4321-B0F4-0C8444C42EF2.

When I try to sync another time, after the error, and select resume, it tells me to have succeeded, but a new event I created is not pulled in from the Nextcloud.

Also, on leaving emacs, I am prompted if the unsaved buffers /tmp/org-caldav-pI92Zo and such should be killed or not. From the org-caldav-debug buffer I gather that those are ics files generated during the errored sync. Like so: ========== Started sync. Check connection for https://server.domain.org/remote.php/dav/calendars/USER/CALENDARNAME/. Generating ICS file /tmp/org-caldav-vUvK04. === Updating EventDB from Org /tmp/org-caldav-pI92Zo. === Updating EventDB from Org

Is that the desired function?

The error is reproducible after having deleted the database file and the entries in the inbox file manually.

I am using Doom Emacs version 2.0.9

I would be glad if anyone could help

Have a great day!

morkr avatar Apr 30 '21 14:04 morkr

@dengste could you give us a hint on how to debug this?

fleimgruber avatar Jun 28 '21 19:06 fleimgruber

Hi, i have the exact same error. Especially the ics file downloaded from Nextcloud has a different UID as name then it is written as UID in the file itself. Any solution here?

zeroset avatar Jul 12 '21 13:07 zeroset

I had the same problem. I am not sure how org-id-find (from org-id) works in detail but apparently the file has to be in the org-agenda-files. I guess only org-agenda-files will be stored in the org-id-locations where org-id searches for the filename of a given ID. If it's not there org-id and org-caldav will not be able to resolve this IDs. But I am not sure.

Maybe this helps a bit.

odi avatar Sep 02 '21 14:09 odi

Thanks @odi ! I have the same problem and cannot try your fix right now. Did it solve the problem for you?

sylph1o avatar Sep 03 '21 09:09 sylph1o

Thanks @odi ! I have the same problem and cannot try your fix right now. Did it solve the problem for you?

Yes it does. In my case it was simple, the file was not in den org-agenda-files and after I added it with e.g. C-c [ or org-agenda-file-to-front it works without any problems.

Because maybe org-id is searching only in the agenda-files? I am not sure.

odi avatar Sep 03 '21 11:09 odi

@odi thanks for sharing this! Adding the calendar file to org-agenda-files solves this for me as well.

fleimgruber avatar Sep 04 '21 16:09 fleimgruber

Am having the same problem and adding the caldav files to the org-agenda-files doesn't resolve the issue. It is weird that the inbox and files org files remain empty after a sync, although the sync file shows the events. EDIT: What fixed the ID not found error is adding the agenda files to org-id-extra-files. Now my calendar remains empty still, but am getting closer.

artelse avatar Nov 14 '21 22:11 artelse

I believe that the ID-related bugs should be fixed now that I've merged https://github.com/dengste/org-caldav/pull/252, but please let us know if you continue to experience these issues.

jackkamm avatar Dec 16 '22 15:12 jackkamm

Hi! First, thank you for the great package.

I just installed org-caldav today and experienced the same behavior described. First sync (Org > Nextcloud) worked perfectly. Next syncs did not work, with the same "Unable to find UID" error.

The error was caused by the calendar org file not being added to org-id-files after the first sync (after creating Org ID's for each entry).

Manual solution:

I created a new heading on the Org calendar file and used the org-id-get-create command to manually create an ID. This action added the calendar file to org-id-files.

I deleted the entry with the manually created ID. Syncing seems to work without an issue now.

Relevant software:

Archlinux Emacs 28.2 Org Mode 9.5.5 org-caldav 20230421.1620

Package configuration:

(use-package org-caldav
  :config
  (setq org-caldav-url "https://url.com/...")
  (setq org-caldav-calendar-id "calendar-id")
  (setq org-caldav-inbox "~/calendar.org")
  (setq org-caldav-files '( "~/calendar.org"))
  (setq org-icalendar-timezone "My/Timezone")
  (setq org-icalendar-alarm-time 30)
  (setq org-caldav-delete-org-entries "always")
  (setq org-caldav-delete-calendar-entries "always"))

tenpast avatar Apr 30 '23 04:04 tenpast