Contact synchronization suddenly stopped working with 500 error

Started happening today just out of sudden.

ed: seem like started happening when i added email to the contact

Logs says

OC\DB\Exceptions\DbalException
An exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint “oc_cards_properties_pkey” DETAIL: Key (id)=(###) already exists.

Haven’t updated yet to 33.0.1, so it’s 33.0.0 and last update of DAVx⁵ 4.5.10-ose was some over a week ago.

Huawei Pura 70 EMUI 14 (Android 12)

Updated to 33.0.1, still same

You seem to have overlooked the support template.

Well all versions are given. Nextcloud itself is TrueNAS app. Database is Postgres 17.

The support template asked for far more than just the versions. For example, if you used it you would know that we can’t help if you don’t provide actual raw log entries/stack traces/etc. (among other things).

There is a database error in first post. Trace of local app wouldn’t help with server side error. For app it’s just 500 error

EXCEPTION
at.bitfire.dav4jvm.okhttp.exception.HttpException: HTTP 500 
	at at.bitfire.dav4jvm.okhttp.DavResource.checkStatus(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:47)
	at at.bitfire.dav4jvm.okhttp.DavResource.put(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:25)
	at at.bitfire.dav4jvm.okhttp.DavResource.put$default(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:25)
	at at.bitfire.davdroid.sync.SyncManager$uploadDirty$4.invokeSuspend$lambda$1(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:22)
	at at.bitfire.davdroid.sync.SyncManager$uploadDirty$4.$r8$lambda$FCsfRWqF7XBSzxEWQovNZVLQuPc(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:1)
	at at.bitfire.davdroid.sync.SyncNotificationManager$$ExternalSyntheticLambda1.invoke(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:38)
	at androidx.glance.appwidget.LayoutConfiguration$save$2.invokeSuspend(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:66)
	at androidx.glance.appwidget.LayoutConfiguration$save$2.invoke(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:18)
	at org.xbill.DNS.Utils.startUndspatched(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:19)
	at kotlinx.coroutines.JobKt.withContext(Unknown Source:47)
	at kotlinx.coroutines.JobKt.runInterruptible(Unknown Source:9)
	at at.bitfire.davdroid.sync.SyncManager$uploadDirty$4.invokeSuspend(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:178)
	at at.bitfire.davdroid.sync.SyncManager$uploadDirty$4.invoke(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:9)
	at at.bitfire.davdroid.sync.SyncManager$uploadDirty$4.invoke(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:14)
	at at.bitfire.davdroid.sync.SyncException$Companion.wrapWithRemoteResourceSuspending(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:67)
	at at.bitfire.davdroid.sync.SyncManager.uploadDirty$suspendImpl(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:225)
	at at.bitfire.davdroid.sync.SyncManager.uploadDirty(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:1)
	at at.bitfire.davdroid.sync.SyncManager.uploadDirty$default(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:8)
	at at.bitfire.davdroid.sync.SyncManager$uploadDirty$2$1$1.invokeSuspend(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:33)
	at at.bitfire.davdroid.sync.SyncManager$uploadDirty$2$1$1.invoke(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:9)
	at at.bitfire.davdroid.sync.SyncManager$uploadDirty$2$1$1.invoke(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:14)
	at at.bitfire.davdroid.sync.SyncException$Companion.wrapWithLocalResourceSuspending(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:67)
	at at.bitfire.davdroid.sync.SyncManager$uploadDirty$2$1.invokeSuspend(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:38)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:9)
	at kotlinx.coroutines.DispatchedTask.run(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:114)
	at androidx.core.app.ActivityRecreator$1.run(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:11)
	at kotlinx.coroutines.scheduling.TaskImpl.run(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:3)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(r8-map-id-8adc80b8aad8a3933e6290344019191e0659ec1ab86e7d94e9157267f79ab7f0:88)

Expanded log redacted. UID is same. Seem started happening when I added email to the contact.

HTTP REQUEST
PUT https://***url***/remote.php/dav/addressbooks/users/***user***/contacts/***UID***.vcf

BEGIN:VCARD
VERSION:4.0
PRODID:+//IDN bitfire.at//DAVx5/4.5.10-ose ez-vcard/0.12.2 (ez-vcard/0.12.2
 )
UID:***UID***
FN:***
N:;***;;;
TEL;TYPE=cell;PREF=1:***
TEL;TYPE=cell:***
EMAIL;TYPE=home:***
REV:20260331T131035Z
END:VCARD


HTTP RESPONSE
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>OC\DB\Exceptions\DbalException</s:exception>
  <s:message>An exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "oc_cards_properties_pkey"
DETAIL:  Key (id)=(397) already exists.</s:message>
</d:error>


LOCAL RESOURCE
LocalContact{id=441, fileName=***UID***.vcf, eTag=***, flags=1}

REMOTE RESOURCE
https://***url***/remote.php/dav/addressbooks/users/***user***/contacts/***UID***.vcf

server side logs

Error no app in context
DbalExceptionAn exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "oc_cards_properties_pkey" DETAIL: Key (id)=(463) already exists.
Uncaught exception

	
Error webdav
DbalExceptionAn exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "oc_cards_properties_pkey" DETAIL: Key (id)=(463) already exists.

	
Error no app in context
DbalExceptionAn exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "oc_cards_properties_pkey" DETAIL: Key (id)=(462) already exists.
Uncaught exception

	
Error webdav
DbalExceptionAn exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "oc_cards_properties_pkey" DETAIL: Key (id)=(462) already exists.

Debug dav
RuntimeExceptionThe loading of lazy AppConfig values have been triggered by app "dav"
# occ config:list system
{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": "***REMOVED SENSITIVE VALUE***"
        },
        "overwriteprotocol": "https",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": true,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "33.0.2.2",
        "overwritehost": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/localhost",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "preview_format": "webp",
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [],
        "loglevel": 0,
        "app_install_overwrite": [
            "maps",
            "gpxpod",
            "music",
            "richdocuments",
            "onlyoffice"
        ],
        "maintenance": false,
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ]
    }
}

some auth related removed from the list
# occ app:list
Enabled:
  - activity: 6.0.0
  - app_api: 33.0.0
  - bruteforcesettings: 6.0.0
  - calendar: 6.2.2
  - circles: 33.0.0
  - cloud_federation_api: 1.17.0
  - comments: 1.23.0
  - contacts: 8.4.3
  - contactsinteraction: 1.14.1
  - dashboard: 7.13.0
  - dav: 1.36.0
  - federatedfilesharing: 1.23.0
  - federation: 1.23.0
  - files: 2.5.0
  - files_downloadlimit: 5.1.0
  - files_pdfviewer: 6.0.0
  - files_reminders: 1.6.0
  - files_sharing: 1.25.2
  - files_trashbin: 1.23.0
  - files_versions: 1.26.0
  - firstrunwizard: 6.0.0
  - gpxpod: 8.2.1
  - logreader: 6.0.0
  - lookup_server_connector: 1.21.0
  - maps: 1.6.0
  - music: 3.0.0
  - nextcloud_announcements: 5.0.0
  - notes: 4.13.1
  - notifications: 6.0.0
  - oauth2: 1.21.0
  - onlyoffice: 10.0.0
  - password_policy: 5.0.0
  - photos: 6.0.0
  - privacy: 5.0.0
  - profile: 1.2.0
  - provisioning_api: 1.23.0
  - recommendations: 6.0.0
  - related_resources: 4.0.0
  - richdocuments: 10.1.2
  - serverinfo: 5.0.0
  - settings: 1.16.0
  - sharebymail: 1.23.0
  - support: 5.0.0
  - survey_client: 5.0.0
  - systemtags: 1.23.0
  - text: 7.0.0
  - theming: 2.8.0
  - twofactor_totp: 15.0.0
  - unroundedcorners: 1.1.5
  - updatenotification: 1.23.0
  - user_status: 1.13.0
  - viewer: 6.0.0
  - weather_status: 1.13.0
  - webhook_listeners: 1.5.0
  - workflowengine: 2.15.0
Disabled:
  - files_external: 1.25.1
  - testing: 1.23.0
  - user_ldap: 1.24.0