Contact sync fails: Record not found in local content provider

  • DAVdroid version 0.8.1 from FDroid
    Nexus 4 (and Nexus 7) running Android 5.1.1
    ownCloud 8.1 DAV server


    I’m having an issue with DavDroid syncing my contacts from ownCloud. This has worked in the past, and then suddenly started doing this. On two different android devices, I suddenly started getting failures with contacts with the error:

    Record not found in local content provider

    This can be seen at the bottom of log 1. Log 1 represents what happens on the device where I haven’t touched anything.

    Snippet from end of log 1:

    V/davdroid.URIUtils(32542): Normalized URI /owncloud/remote.php/carddav/addressbooks/USER/contacts/ -> /owncloud/remote.php/carddav/addressbooks/USER/contacts/ assuming that it was an URI or path name
    E/davdroid.DavSyncAdapter(32542): Local storage (content provider) exception
    E/davdroid.DavSyncAdapter(32542): at.bitfire.davdroid.resource.RecordNotFoundException: Record not found in local content provider
    E/davdroid.DavSyncAdapter(32542): 	at at.bitfire.davdroid.resource.LocalCollection.findByRemoteName(
    E/davdroid.DavSyncAdapter(32542): 	at at.bitfire.davdroid.resource.LocalCollection.updateByRemoteName(
    E/davdroid.DavSyncAdapter(32542): 	at at.bitfire.davdroid.syncadapter.SyncManager.pullChanged(
    E/davdroid.DavSyncAdapter(32542): 	at at.bitfire.davdroid.syncadapter.SyncManager.synchronize(
    E/davdroid.DavSyncAdapter(32542): 	at at.bitfire.davdroid.syncadapter.DavSyncAdapter.onPerformSync(
    E/davdroid.DavSyncAdapter(32542): 	at android.content.AbstractThreadedSyncAdapter$
    I/davdroid.DavSyncAdapter(32542): Sync complete for
    D/davdroid.DavSyncAdapter(32542): Closing httpClient

    Full log 1 download:

    Device 2 (log 2) was doing the same thing as device 1, but I tried removing and re-adding the account. Now, device 2 has about 10 random contacts synchronized. When I force the sync, the Contacts app shows the contacts loading (about 400), but in the middle of synchronizing, it bombs out, and rolls back to the 10 random contacts. No error message is displayed on screen, but log 2 has everything in it.

    Snippet from end of log 2:

    D/davdroid.SyncManager( 5222): Adding
    D/davdroid.Collection( 5222): Committing 4 operations ...
    D/davdroid.Collection( 5222): ... 0 row(s) affected
    I/davdroid.SyncManager( 5222): Fetching 0 updated remote resource(s)
    I/davdroid.SyncManager( 5222): Removing non-dirty resources that are not present remotely anymore
    I/davdroid.SyncManager( 5222): Sync complete, fetching new CTag
    I/davdroid.DavSyncAdapter( 5222): Sync complete for
    D/davdroid.DavSyncAdapter( 5222): Closing httpClient

    Full log 2 download:


  • admin

    thanks for the bug report. It seems this is a duplicate of #578

    Please read:

    To fix it please delete the “urlencode” in lib/carddav/backend.php in you Owncloud. Alternatively you can wait for the already existing oc patch to come live with an updated version of owncloud. Also please use DAVdroid 0.8.3, which is the latest version, to avoid other incompatibilities.

    DeepDiver1975 created this issue in owncloud/contacts

    closed Add screenshot to info.xml #581

  • No good. I’m running DAVDroid 0.8.3 and Owncloud 8.1.0. I fixed apps/contacts/lib/carddav/backend.php as instructed, but I’m still getting this error.

  • Updated to OC 8.1.1 to no avail.

  • All right, my problem was solved by disabling Cyanogenmod’s Privacy Guard for DAVDroid.

  • admin

    Great that you found out!

  • @devvv4ever, thanks! Sorry to have located an ownCloud issue and represent it as a Dav one. Your recommendation has fixed things for me, so I’m going to close this out. Thanks again.

  • admin

    You’re welcome. Thanks for the update

  • I have the same problem since today …

    Nothing is changed at owncloud or my phone, I only added 2 phone numbers to a contact.

    What should i fix here:
    [code]cat /var/www/owncloud/apps/contacts/lib/carddav/backend.php | grep urlencode
    ‘uri’ => urlencode($contact[‘uri’]),

    Deleting contacts at the phone and resyncing is working, but no contacts are synced.
    I completely removed the contact app folder and reinstalled it at owncloud.
    At the owncloud log are also no errors about this sync failure and the davdroid app is also syncing successfully.

    Please help 😕

Similar topics