I had previously problems with the birthday calendar as one contact couldn’t be parsed. I could solve the problem and want to trigger update of birthday calendar as some contacts are missing:
sudo -u http php occ -vvv dav:sync-birthday-calendar username
However, it stops with following exception:
In CalDavBackend.php line 1068:
Calendar object with uid already exists in this calendar collection.
OCA\DAV\CalDAV\CalDavBackend->createCalendarObject() at /usr/share/webapps/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php:383
OCA\DAV\CalDAV\BirthdayService->updateCalendar() at /usr/share/webapps/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php:125
OCA\DAV\CalDAV\BirthdayService->onCardChanged() at /usr/share/webapps/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php:316
OCA\DAV\CalDAV\BirthdayService->syncUser() at /usr/share/webapps/nextcloud/apps/dav/lib/Command/SyncBirthdayCalendar.php:93
OCA\DAV\Command\SyncBirthdayCalendar->execute() at /usr/share/webapps/nextcloud/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /usr/share/webapps/nextcloud/3rdparty/symfony/console/Application.php:915
Symfony\Component\Console\Application->doRunCommand() at /usr/share/webapps/nextcloud/3rdparty/symfony/console/Application.php:272
Symfony\Component\Console\Application->doRun() at /usr/share/webapps/nextcloud/3rdparty/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /usr/share/webapps/nextcloud/lib/private/Console/Application.php:214
OC\Console\Application->run() at /usr/share/webapps/nextcloud/console.php:99
require_once() at /usr/share/webapps/nextcloud/occ:11
Unfortunatelly, increasing the verbosity does not give more information. How I can track down the problem?
Have you tried to delete and recreate the birthday calendar?
Just delete it from within calendar web app? This didn’t seem to work.
It states that birthday calendar is re-anabled:
Re-enabling birthday calendar for username
Start birthday calendar sync for username
However, the error is the same.
If I’m not wrong, this should happen only if two contacts have same UIDs, or one contact has twice the property birthday, death date or anniversary.
If you don’t have a lot of contacts, check if the contacts app doesn’t suggest to fix some contacts.
Otherwise you can also edit
apps/dav/lib/CalDAV/CalDavBackend.php by replacing :
throw new \Sabre\DAV\Exception\BadRequest('Calendar object with uid already exists in this calendar collection.');
throw new \Sabre\DAV\Exception\BadRequest('Calendar object with uid '. $extraData['uid'] . ' already exists in this calendar collection.');
which will give you the duplicated unique ID when you run sync again. If it ends with
-anniversary, remove that part.
select carddata from oc_cards where uid = %found_id% shoud give you the VCS data corresponding to the faulty contact.
Thanks, there was indeed two entries with the same uid. Don’t know how this happend.
Thus, I deleted one row.
But now it gets strange: Removing again the birthday calendar and running occ gives the same result with the same uid. Although there is now just one entry in the database…
The card has
Does this give problems?
And it seems to be the only one which has a VALUE parameter:
Other just have
Don’t know if it is of any relevance.
I removed the entry and now everything works as expected.
I don’t know what was the problem, so I post the (anonymized) content of the affected entry. It might help someone finding the root of the cause:
Thanks for the quick hints, it helped a lot.