Skip to content

[Bug]: occ federation:sync-addressbooks failed with VCard object with uid already exists in this addressbook #50715

@criegerde

Description

@criegerde

⚠️ This issue respects the following points: ⚠️

Bug description

We are trying to federate to server.
One of the server has a green light and both, the adressbook and federation sync went well.

Image

On the second server the federation fails. Running
OK: occ federation:sync-addressbooks
FAILED: occ federation:sync-addressbooks
Satus: red light.

Image

Running occ federation:sync-addressbooks -vvv will fail with
Error while syncing https://nc-domain : VCard object with uid already exists in this addressbook collection.

In the nextcloud.log the corresponding error is:
{"reqId":"AzTnCXqiI3wLnWv2yv82","level":3,"time":"2025-02-07T13:53:44+01:00","remoteAddr":"","user":"--","app":"federation","method":"","url":"--","message":"Server sync for https://nc-domain failed.","userAgent":"--","version":"30.0.5.1","exception":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"VCard object with uid already exists in this addressbook collection.","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/public/AppFramework/Db/TTransactional.php","line":45,"function":"OCA\\DAV\\CardDAV\\{closure}","class":"OCA\\DAV\\CardDAV\\CardDavBackend","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/dav/lib/CardDAV/CardDavBackend.php","line":610,"function":"atomic","class":"OCA\\DAV\\CardDAV\\CardDavBackend","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/CardDAV/SyncService.php","line":83,"function":"createCard","class":"OCA\\DAV\\CardDAV\\CardDavBackend","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/public/AppFramework/Db/TTransactional.php","line":45,"function":"OCA\\DAV\\CardDAV\\{closure}","class":"OCA\\DAV\\CardDAV\\SyncService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/dav/lib/CardDAV/SyncService.php","line":80,"function":"atomic","class":"OCA\\DAV\\CardDAV\\SyncService","type":"->"},{"file":"/var/www/nextcloud/apps/federation/lib/SyncFederationAddressBooks.php","line":58,"function":"syncRemoteAddressBook","class":"OCA\\DAV\\CardDAV\\SyncService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/federation/lib/Command/SyncFederationAddressBooks.php","line":34,"function":"syncThemAll","class":"OCA\\Federation\\SyncFederationAddressBooks","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":326,"function":"execute","class":"OCA\\Federation\\Command\\SyncFederationAddressBooks","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1078,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":324,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":175,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":183,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/console.php","line":87,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/CardDAV/CardDavBackend.php","Line":622,"message":"Server sync for https://nc-domain failed.","exception":{},"CustomMessage":"Server sync for https://nc-domain failed."}}

Steps to reproduce

  1. occ dav:sync-system-addressbook
  2. occ federation:sync-addressbooks

Expected behavior

Should work as on the other (federated) server:

Image

Image

Nextcloud Server version

30

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.esz-radebeul.de",
            "144.76.137.213"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "30.0.5.1",
        "overwrite.cli.url": "https:\/\/cloud.esz-radebeul.de",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "overwritehost": "cloud.esz-radebeul.de",
        "activity_expire_days": 14,
        "allow_local_remote_servers": true,
        "auth.bruteforce.protection.enabled": true,
        "forbidden_filenames": [
            ".htaccess",
            "Thumbs.db",
            "thumbs.db"
        ],
        "cron_log": true,
        "default_phone_region": "DE",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\Movie",
            "OC\\Preview\\PDF",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\Movie",
            "OC\\Preview\\MKV",
            "OC\\Preview\\MP4",
            "OC\\Preview\\AVI"
        ],
        "filesystem_check_changes": 0,
        "filelocking.enabled": "true",
        "htaccess.RewriteBase": "\/",
        "integrity.check.disabled": false,
        "knowledgebaseenabled": false,
        "log_rotate_size": "104857600",
        "logfile": "\/var\/log\/nextcloud\/cloud.esz-radebeul.de.log",
        "loglevel": 2,
        "logtimezone": "Europe\/Berlin",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "overwriteprotocol": "https",
        "preview_max_x": 1024,
        "preview_max_y": 768,
        "preview_max_scale_factor": 1,
        "profile.enabled": false,
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "password": "***REMOVED SENSITIVE VALUE***",
            "timeout": 0.5,
            "dbindex": 1
        },
        "quota_include_external_storage": false,
        "share_folder": "\/Freigaben",
        "skeletondirectory": "",
        "trashbin_retention_obligation": "auto, 7",
        "maintenance_window_start": 1,
        "maintenance": false,
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "defaultapp": "files",
        "app_install_overwrite": [
            "files_fulltextsearch_tesseract"
        ],
        "memories.db.triggers.fcu": true,
        "memories.exiftool": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/exiftool-amd64-glibc",
        "memories.vod.path": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/go-vod-amd64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "forbidden_filename_characters": [
            "\\",
            "\/"
        ],
        "forbidden_filename_extensions": [
            ".filepart",
            ".part"
        ]
    }
}

List of activated Apps

Enabled:
  - activity: 3.0.0
  - admin_audit: 1.20.0
  - announcementcenter: 7.1.0
  - app_api: 4.0.5
  - bbb: 2.7.3
  - bruteforcesettings: 3.0.0
  - calendar: 5.0.9
  - circles: 30.0.0
  - cloud_federation_api: 1.13.0
  - comments: 1.20.1
  - contacts: 6.1.3
  - contactsinteraction: 1.11.0
  - dashboard: 7.10.0
  - data_request: 2.0.1
  - dav: 1.31.1
  - deck: 1.14.3
  - federatedfilesharing: 1.20.0
  - federation: 1.20.0
  - files: 2.2.0
  - files_automatedtagging: 1.20.0
  - files_downloadlimit: 3.0.0
  - files_fulltextsearch: 30.0.0
  - files_fulltextsearch_tesseract: 27.0.0
  - files_pdfviewer: 3.0.0
  - files_reminders: 1.3.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - files_versions: 1.23.0
  - forms: 4.3.6
  - fulltextsearch: 30.0.0
  - fulltextsearch_elasticsearch: 30.0.0
  - groupfolders: 18.0.9
  - impersonate: 1.17.1
  - logreader: 3.0.0
  - lookup_server_connector: 1.18.0
  - memories: 7.4.1
  - nextcloud_announcements: 2.0.0
  - notes: 4.11.0
  - notifications: 3.0.0
  - notify_push: 1.0.0
  - oauth2: 1.18.1
  - password_policy: 2.0.0
  - photos: 3.0.2
  - polls: 7.2.9
  - privacy: 2.0.0
  - provisioning_api: 1.20.0
  - quota_warning: 1.20.0
  - related_resources: 1.5.0
  - richdocuments: 8.5.3
  - secrets: 2.1.2
  - serverinfo: 2.0.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - spreed: 20.1.3
  - systemtags: 1.20.0
  - tables: 0.8.4
  - text: 4.1.0
  - theming: 2.5.0
  - twofactor_backupcodes: 1.19.0
  - updatenotification: 1.20.0
  - user_ldap: 1.21.0
  - user_migration: 7.0.1
  - user_saml: 6.5.0
  - user_status: 1.10.0
  - viewer: 3.0.0
  - weather_status: 1.10.0
  - webhook_listeners: 1.1.0-dev
  - whiteboard: 1.0.5
  - workflowengine: 2.12.0
Disabled:
  - encryption: 2.18.0
  - files_external: 1.22.0
  - firstrunwizard: 3.0.0 (installed 3.0.0)
  - recommendations: 3.0.0 (installed 3.0.0)
  - support: 2.0.0 (installed 2.0.0)
  - survey_client: 2.0.0 (installed 2.0.0)
  - suspicious_login: 8.0.0
  - twofactor_nextcloud_notification: 4.0.0
  - twofactor_totp: 12.0.0-dev

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

`{"reqId":"AzTnCXqiI3wLnWv2yv82","level":3,"time":"2025-02-07T13:53:44+01:00","remoteAddr":"","user":"--","app":"federation","method":"","url":"--","message":"Server sync for https://nc-domain failed.","userAgent":"--","version":"30.0.5.1","exception":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"VCard object with uid already exists in this addressbook collection.","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/public/AppFramework/Db/TTransactional.php","line":45,"function":"OCA\\DAV\\CardDAV\\{closure}","class":"OCA\\DAV\\CardDAV\\CardDavBackend","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/dav/lib/CardDAV/CardDavBackend.php","line":610,"function":"atomic","class":"OCA\\DAV\\CardDAV\\CardDavBackend","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/CardDAV/SyncService.php","line":83,"function":"createCard","class":"OCA\\DAV\\CardDAV\\CardDavBackend","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/public/AppFramework/Db/TTransactional.php","line":45,"function":"OCA\\DAV\\CardDAV\\{closure}","class":"OCA\\DAV\\CardDAV\\SyncService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/dav/lib/CardDAV/SyncService.php","line":80,"function":"atomic","class":"OCA\\DAV\\CardDAV\\SyncService","type":"->"},{"file":"/var/www/nextcloud/apps/federation/lib/SyncFederationAddressBooks.php","line":58,"function":"syncRemoteAddressBook","class":"OCA\\DAV\\CardDAV\\SyncService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/federation/lib/Command/SyncFederationAddressBooks.php","line":34,"function":"syncThemAll","class":"OCA\\Federation\\SyncFederationAddressBooks","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":326,"function":"execute","class":"OCA\\Federation\\Command\\SyncFederationAddressBooks","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1078,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":324,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":175,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":183,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/console.php","line":87,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/CardDAV/CardDavBackend.php","Line":622,"message":"Server sync for https://nc-domain failed.","exception":{},"CustomMessage":"Server sync for https://nc-domain failed."}}`

Additional info

occ dav:sync-system-addressbook works as expected

Image

occ federation:sync-addressbooks -vvv failed

Image

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap30-feedbackbug

    Type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions