kidd / org-gcal.el

Org sync with Google Calendar. (active maintained project as of 2019-11-06)
432 stars 47 forks source link

[error] request--callback: peculiar error: 412 on org-gcal-sync #214

Closed megodoonch closed 1 year ago

megodoonch commented 1 year ago

I have an event called "test with inserted text" Scheduled to <2022-11-23 Wed> that I created in orgmode and had already used org-gcal-post-at-point to push to a google calendar with ID <my-calendar-id>. I have not edited it in either place since.

When I use org-gcal-sync most stuff works, but (a) it posts the event again (once? twice? four times?), and (b) I get an error from request that I don't understand.

I had something similar yesterday with events originally pulled from google calendar as well, and this seemed to prevent any updates to that org-file. Finally I just deleted that file and re-fetched.

Here's what I'm pretty sure is the relevant part of the Messages:

Decrypting /home/mego/.emacs.d/oauth2-auto.plist...0%
Scheduled to <2022-11-23 Wed>
Org-gcal post event
  test with inserted text
Event Posted
Org-gcal post event
  test with inserted text
Decrypting /home/mego/.emacs.d/oauth2-auto.plist...done
[error] request--callback: peculiar error: 412
[error] request-default-error-callback: https://www.googleapis.com/calendar/v3/calendars/<my-calendar-id>group.calendar.google.com/events/<event-id> error
ETag stale for test with inserted text
<my-calendar-id>@group.calendar.google.com

Will overwrite this entry with event from server.
Received HTTP 412
ETag stale for test with inserted text
<event-id>/<my-calendar-id>@group.calendar.google.com

Will overwrite this entry with event from server.
Decrypting /home/mego/.emacs.d/oauth2-auto.plist...done
Scheduled to <2022-11-23 Wed>
megodoonch commented 1 year ago

Ooh, could it be related to the fact that this event doesn't live in the file in the org-gcal-fetch-file-alist list of associated files and calendar IDs?

telotortium commented 1 year ago

HTTP 412 is not an error - perhaps I should change the notification text. It's what the Google Calendar API responds with when the org-gcal event in the local file is not up to date with the event on the server. In that case, the local event is overwritten with the API event. Something must be changing the event on the API side (or you have something that's reverting the ETag property on the local side to an old value).

Ooh, could it be related to the fact that this event doesn't live in the file in the org-gcal-fetch-file-alist list of associated files and calendar IDs?

That shouldn't matter. Whenever an event is fetched from the API or created with org-gcal-post-at-point, the list of event IDs in org-generic-id-locations-file should be updated to contain the event ID. Later, org-gcal should consult this list of IDs to find any events synced from the server, so there shouldn't be duplicates. However, there might still be a bug here if you're getting duplicates of the same events.

megodoonch commented 1 year ago

Ah, OK, so the [error] bit isn't an error as far as we're concerned. No, I'm not getting duplicates. I don't know why the ETag is changing; I suppose something could be happening with my Syncthing syncronisations. I'll look into it. In any case, if this isn't an error, I think you can close this. (Or do I do that? I'm not sure how GitHub issues work...)