Android.database.sqlite.SQLiteConstraintException: contacts.pinned may not be NULL (code 19)



  • Not easy to know what is the relevant data, but I will try 😄

    V/davdroid.URIUtils(  342): Normalized URL /owncloud/remote.php/carddav/addressbooks/dominik/kontakte/6e4cad71-9eb0-4b74-90a2-da5b422e47a5.vcf -> /owncloud/remo
    te.php/carddav/addressbooks/dominik/kontakte/6e4cad71-9eb0-4b74-90a2-da5b422e47a5.vcf
    D/davdroid.WebDavResource(  342): Processing multi-status element: https://chii.selfhost.eu/owncloud/remote.php/carddav/addressbooks/dominik/kontakte/6e4cad71-9
    eb0-4b74-90a2-da5b422e47a5.vcf
    V/davdroid.URIUtils(  342): Normalized URL /owncloud/remote.php/carddav/addressbooks/dominik/kontakte/940b9f55-6690-45c9-9519-53d486edd4d7.vcf -> /owncloud/remo
    te.php/carddav/addressbooks/dominik/kontakte/940b9f55-6690-45c9-9519-53d486edd4d7.vcf
    D/davdroid.WebDavResource(  342): Processing multi-status element: https://chii.selfhost.eu/owncloud/remote.php/carddav/addressbooks/dominik/kontakte/940b9f55-6
    690-45c9-9519-53d486edd4d7.vcf
    V/davdroid.URIUtils(  342): Normalized URL /owncloud/remote.php/carddav/addressbooks/dominik/kontakte/d00ef02c-2d3e-4ad8-adfb-303764077bd8.vcf -> /owncloud/remo
    te.php/carddav/addressbooks/dominik/kontakte/d00ef02c-2d3e-4ad8-adfb-303764077bd8.vcf
    D/davdroid.WebDavResource(  342): Processing multi-status element: https://chii.selfhost.eu/owncloud/remote.php/carddav/addressbooks/dominik/kontakte/d00ef02c-2
    d3e-4ad8-adfb-303764077bd8.vcf
    D/Wire    (  342): http-outgoing-1 << "[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "0[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "[\r][\n]"
    D/HttpClient(  342): Connection [id: 1][route: HttpRoute[{s}->https://chii.selfhost.eu:443]] can be kept alive for 5.0 seconds
    D/HttpClient(  342): Connection released: [id: 1][route: HttpRoute[{s}->https://chii.selfhost.eu:443]][total kept alive: 1; route allocated: 1 of 2; total alloc
    ated: 1 of 3]
    D/dalvikvm( 1838): JIT code cache reset in 0 ms (4096 bytes 2/0)
    I/davdroid.SyncManager(  342): Fetching 0 new remote resource(s)
    I/davdroid.SyncManager(  342): Fetching 2 updated remote resource(s)
    I/davdroid.RemoteCollection(  342): Multi-getting 2 remote resource(s)
    D/HttpClient(  342): Connection request: [route: HttpRoute[{s}->https://chii.selfhost.eu:443]][total kept alive: 1; route allocated: 1 of 2; total allocated: 1
    of 3]
    D/HttpClient(  342): Connection leased: [id: 1][route: HttpRoute[{s}->https://chii.selfhost.eu:443]][total kept alive: 0; route allocated: 1 of 2; total allocat
    ed: 1 of 3]
    D/HttpClient(  342): Executing request REPORT /owncloud/remote.php/carddav/addressbooks/dominik/kontakte/ HTTP/1.1
    D/HttpClient(  342): Target auth state: SUCCESS
    D/HttpClient(  342): Proxy auth state: UNCHALLENGED
    D/Wire    (  342): http-outgoing-1 >> "REPORT /owncloud/remote.php/carddav/addressbooks/dominik/kontakte/ HTTP/1.1[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "Content-Type: text/xml; charset=UTF-8[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "Accept: text/xml[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "Depth: 1[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "Content-Length: 402[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "Host: chii.selfhost.eu[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "User-Agent: DAVdroid/0.6.12[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "Authorization: Basic ********************=[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "[\r][\n]"
    D/Wire    (  342): http-outgoing-1 >> "<CD:addressbook-multiget xmlns:CD="urn:ietf:params:xml:ns:carddav" xmlns="DAV:">[\n]"
    D/Wire    (  342): http-outgoing-1 >> "   <prop>[\n]"
    D/Wire    (  342): http-outgoing-1 >> "      <CD:address-data/>[\n]"
    D/Wire    (  342): http-outgoing-1 >> "      <getetag/>[\n]"
    D/Wire    (  342): http-outgoing-1 >> "   </prop>[\n]"
    D/Wire    (  342): http-outgoing-1 >> "   <href>/owncloud/remote.php/carddav/addressbooks/dominik/kontakte/ad021c2e-04a6-4b6a-9f58-18f270eff72f.vcf</href>[\n]"
    D/Wire    (  342): http-outgoing-1 >> "   <href>/owncloud/remote.php/carddav/addressbooks/dominik/kontakte/C60F1998-1D70-0001-6A66-341315401F95.vcf</href>[\n]"
    D/Wire    (  342): http-outgoing-1 >> "</CD:addressbook-multiget>"
    D/Wire    (  342): http-outgoing-1 << "HTTP/1.1 207 Multi-Status[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Date: Thu, 19 Feb 2015 08:41:52 GMT[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Server: Apache/2.2.22 (Debian)[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "X-Powered-By: PHP/5.4.36-0+deb7u3[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Set-Cookie: oc020f2df3d3=4kh4l1rnd6a3h9rlba57c0bhj2; path=/owncloud; HttpOnly[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Expires: Thu, 19 Nov 1981 08:52:00 GMT[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Cache-Control: private, max-age=10800, pre-check=10800[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Last-Modified: Sat, 07 Feb 2015 02:31:55 GMT[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Strict-Transport-Security: max-age=31536000[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "X-XSS-Protection: 1; mode=block[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "X-Content-Type-Options: nosniff[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "X-Frame-Options: Sameorigin[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src
     *; img-src *; font-src 'self' data:; media-src *; connect-src *[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "X-Robots-Tag: none[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Set-Cookie: oc020f2df3d3=5kqm9bciocuphp5acmg6bv9dc2; path=/owncloud; secure; HttpOnly[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Vary: Brief,Prefer[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Content-Length: 1343[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Keep-Alive: timeout=5, max=99[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Connection: Keep-Alive[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "Content-Type: application/xml; charset=utf-8[\r][\n]"
    D/Wire    (  342): http-outgoing-1 << "[\r][\n]"
    D/HttpClient(  342): Connection can be kept alive for 5000 MILLISECONDS
    D/Wire    (  342): http-outgoing-1 << "<?xml version="1.0" encoding="utf-8"?>[\n]"
    D/Wire    (  342): http-outgoing-1 << "<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:card="urn:ietf:params:xml:ns:carddav"><d:response><d
    :href>/owncloud/remote.php/carddav/addressbooks/dominik/kontakte/ad021c2e-04a6-4b6a-9f58-18f270eff72f.vcf</d:href><d:propstat><d:prop><card:address-data>BEGIN:V
    CARD&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "VERSION:3.0&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "UID:ad021c2e-04a6-4b6a-9f58-18f270eff72f&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "FN:Seetec&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "N:;Seetec;;;&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "TEL;TYPE=home:+49 7251 92900&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "ORG:Seetec AG&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "PRODID:DAVdroid/0.6.10.1 (ez-vcard/0.9.6)&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "REV:2015-01-11T12:32:58+00:00&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "END:VCARD&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "</card:address-data><d:getetag>"cef99d344aa304dc9e2655e17218a6cb"</d:getetag></d:prop><d:status>HTTP/1.1 200 OK</d:status
    ></d:propstat></d:response><d:response><d:href>/owncloud/remote.php/carddav/addressbooks/dominik/kontakte/C60F1998-1D70-0001-6A66-341315401F95.vcf</d:href><d:pr
    opstat><d:prop><card:address-data>BEGIN:VCARD&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "VERSION:3.0&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "X-MOZILLA-HTML:FALSE&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "UID:C60F1998-1F80-0001-18C7-1A4064409470&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "FN:Bengali Ottenau&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "N:;Bengali Ottenau;;;&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "TEL;TYPE=work:0049722574552&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "PRODID:DAVdroid/0.6.10.1 (ez-vcard/0.9.6)&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "REV:2015-01-11T12:32:57+00:00&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "END:VCARD&#13;[\n]"
    D/Wire    (  342): http-outgoing-1 << "</card:address-data><d:getetag>"b3e261391d18799d0f505a68cc4b2c88"</d:getetag></d:prop><d:status>HTTP/1.1 200 OK</d:status
    ></d:propstat></d:response></d:multistatus>[\n]"
    V/davdroid.URIUtils(  342): Normalized URL /owncloud/remote.php/carddav/addressbooks/dominik/kontakte/ad021c2e-04a6-4b6a-9f58-18f270eff72f.vcf -> /owncloud/remo
    te.php/carddav/addressbooks/dominik/kontakte/ad021c2e-04a6-4b6a-9f58-18f270eff72f.vcf
    D/davdroid.WebDavResource(  342): Processing multi-status element: https://chii.selfhost.eu/owncloud/remote.php/carddav/addressbooks/dominik/kontakte/ad021c2e-0
    4a6-4b6a-9f58-18f270eff72f.vcf
    V/davdroid.URIUtils(  342): Normalized URL /owncloud/remote.php/carddav/addressbooks/dominik/kontakte/C60F1998-1D70-0001-6A66-341315401F95.vcf -> /owncloud/remo
    te.php/carddav/addressbooks/dominik/kontakte/C60F1998-1D70-0001-6A66-341315401F95.vcf
    D/davdroid.WebDavResource(  342): Processing multi-status element: https://chii.selfhost.eu/owncloud/remote.php/carddav/addressbooks/dominik/kontakte/C60F1998-1
    D70-0001-6A66-341315401F95.vcf
    D/HttpClient(  342): Connection [id: 1][route: HttpRoute[{s}->https://chii.selfhost.eu:443]] can be kept alive for 5.0 seconds
    D/HttpClient(  342): Connection released: [id: 1][route: HttpRoute[{s}->https://chii.selfhost.eu:443]][total kept alive: 1; route allocated: 1 of 2; total alloc
    ated: 1 of 3]
    I/davdroid.SyncManager(  342): Updating ad021c2e-04a6-4b6a-9f58-18f270eff72f.vcf
    D/davdroid.LocalCollection(  342): Committing 5 operations
    W/ContactsDatabaseHelper( 1838): invalidateAllCache: [ContactsDatabaseHelper]
    E/DatabaseUtils( 1838): Writing exception to parcel
    E/DatabaseUtils( 1838): android.database.sqlite.SQLiteConstraintException: contacts.pinned may not be NULL (code 19)
    E/DatabaseUtils( 1838):         at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
    E/DatabaseUtils( 1838):         at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:555)
    E/DatabaseUtils( 1838):         at android.database.sqlite.SQLiteSession.execute(SQLiteSession.java:619)
    E/DatabaseUtils( 1838):         at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:44)
    E/DatabaseUtils( 1838):         at com.android.providers.contacts.aggregation.ContactAggregator.updatePinned(ContactAggregator.java:2373)
    E/DatabaseUtils( 1838):         at com.android.providers.contacts.ContactsProvider2.updateRawContact(ContactsProvider2.java:4414)
    E/DatabaseUtils( 1838):         at com.android.providers.contacts.ContactsProvider2.updateRawContacts(ContactsProvider2.java:4322)
    E/DatabaseUtils( 1838):         at com.android.providers.contacts.ContactsProvider2.updateInTransaction(ContactsProvider2.java:3975)
    E/DatabaseUtils( 1838):         at com.android.providers.contacts.AbstractContactsProvider.update(AbstractContactsProvider.java:166)
    E/DatabaseUtils( 1838):         at com.android.providers.contacts.ContactsProvider2.update(ContactsProvider2.java:2138)
    E/DatabaseUtils( 1838):         at android.content.ContentProviderOperation.apply(ContentProviderOperation.java:225)
    E/DatabaseUtils( 1838):         at com.android.providers.contacts.AbstractContactsProvider.applyBatch(AbstractContactsProvider.java:237)
    E/DatabaseUtils( 1838):         at com.android.providers.contacts.ContactsProvider2.applyBatch(ContactsProvider2.java:2250)
    E/DatabaseUtils( 1838):         at android.content.ContentProvider$Transport.applyBatch(ContentProvider.java:260)
    E/DatabaseUtils( 1838):         at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:192)
    E/DatabaseUtils( 1838):         at android.os.Binder.execTransact(Binder.java:404)
    E/DatabaseUtils( 1838):         at dalvik.system.NativeStart.run(Native Method)
    W/dalvikvm(  342): threadid=13: thread exiting with uncaught exception (group=0x41946ce0)
    D/davdroid.DavSyncAdapter(  342): Closing httpClient
    E/AndroidRuntime(  342): FATAL EXCEPTION: SyncAdapterThread-1
    E/AndroidRuntime(  342): Process: at.bitfire.davdroid:sync, PID: 342
    E/AndroidRuntime(  342): android.database.sqlite.SQLiteConstraintException: contacts.pinned may not be NULL (code 19)
    E/AndroidRuntime(  342):        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:173)
    E/AndroidRuntime(  342):        at android.database.DatabaseUtils.readExceptionWithOperationApplicationExceptionFromParcel(DatabaseUtils.java:160)
    E/AndroidRuntime(  342):        at android.content.ContentProviderProxy.applyBatch(ContentProviderNative.java:519)
    E/AndroidRuntime(  342):        at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:377)
    E/AndroidRuntime(  342):        at at.bitfire.davdroid.resource.LocalCollection.commit(LocalCollection.java:312)
    E/AndroidRuntime(  342):        at at.bitfire.davdroid.resource.LocalAddressBook.commit(LocalAddressBook.java:148)
    E/AndroidRuntime(  342):        at at.bitfire.davdroid.syncadapter.SyncManager.pullChanged(SyncManager.java:210)
    E/AndroidRuntime(  342):        at at.bitfire.davdroid.syncadapter.SyncManager.synchronize(SyncManager.java:91)
    E/AndroidRuntime(  342):        at at.bitfire.davdroid.syncadapter.DavSyncAdapter.onPerformSync(DavSyncAdapter.java:144)
    E/AndroidRuntime(  342):        at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
    D/HttpClient(  342): Connection manager is shutting down
    D/HttpClient(  342): http-outgoing-1: Close connection
    D/HttpClient(  342): http-outgoing-1: Close connection
    D/HttpClient(  342): Connection manager shut down
    


  • Do you need more/other logs ?
    Maybe I can give you access to my smartphone for one or two evenings (ssh/linux, windows teamviewer VM with USB connected smartphone, ) if this can help.

    Greetings


  • developer

    Still no idea what the reason could be.

    @S2- @chiisama Which exact Android version do you use? The stock version (of which brand)? CyanogenMod?

    At the moment, I guess this is an issue with a few manufacturer-adapted Android versions.



  • i’m on cyanogenmod. latest stable.
    deleting the contact that generated the error and recreating it solved the problem for me. it never happened again.



  • Cyanogenmod last 11-20141115-SNAPSHOT-M12-i9300 (4.4.4)
    S2 - How you now which one cause the error ?



  • @chiisama i watched the logs with adb while syncing, and the last one that appeared before the exception was the guilty one.



  • The last one was Bengali Ottenau in the log above. Deleting this does not help.
    I removed the carddav account in davdroid and readded it. Error gone.
    The only thing that I did that may can corrupt the database is the SDMaid app.
    This app has the option to “optimize” the database. I tried to reproduce the error running sdmaid again but no problem wiht davdroid yet.



  • This bug just hit me and was gone after deleting the affected contact from the server. I believe i triggered the issue by adding the contact first and moving it into a contacts group using the ownCloud webinterface later after syncing.



  • I’m having the same issue with Alcatel 5038D stock rom, DAVdroid 0.7.2.



  • I fixed the problem starring the contact and syncing. Then I can unstar it and it syncs OK from now on.


  • developer

    And again with 0.7.5 (from Play Store):

    Moto X (ghost) with Android 4.4:

    android.database.sqlite.SQLiteConstraintException: contacts.pinned may not be NULL (code 19)
    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:173)
    at android.database.DatabaseUtils.readExceptionWithOperationApplicationExceptionFromParcel(DatabaseUtils.java:160)
    at android.content.ContentProviderProxy.applyBatch(ContentProviderNative.java:512)
    at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:377)
    at at.bitfire.davdroid.resource.LocalCollection.commit(LocalCollection.java:327)
    at at.bitfire.davdroid.resource.LocalAddressBook.commit(LocalAddressBook.java:156)
    at at.bitfire.davdroid.syncadapter.SyncManager.pullChanged(SyncManager.java:210)
    at at.bitfire.davdroid.syncadapter.SyncManager.synchronize(SyncManager.java:91)
    at at.bitfire.davdroid.syncadapter.DavSyncAdapter.onPerformSync(DavSyncAdapter.java:146)
    at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
    

  • developer

    According to https://github.com/android/platform_packages_providers_contactsprovider/blob/android-5.1.1_r4/src/com/android/providers/contacts/ContactsDatabaseHelper.java#L1213, the RawContact’s PINNED is always DEFAULT unpinned, so there should be no need to set it explicitly.


Log in to reply