Sync fails with "PREF parameter value is malformed and could not be parsed"


Nextcloud 10.0.2

One contact failed the sync. It had the following line:

Stacktrace of error>
EXCEPTION java.lang.IllegalStateException: [Error 15] PREF parameter value is malformed and could not be parsed. Retrieve its raw text values instead by calling property.getParameters().get("PREF").
at ezvcard.parameter.VCardParameters.getPref(
at at.bitfire.vcard4android.AndroidContact.insertEmail(
at at.bitfire.vcard4android.AndroidContact.insertDataRows(
at at.bitfire.davdroid.resource.LocalContact.insertDataRows(
at at.bitfire.vcard4android.AndroidContact.create(
at at.bitfire.davdroid.syncadapter.ContactsSyncManager.processVCard(
at at.bitfire.davdroid.syncadapter.ContactsSyncManager.downloadRemote(
at at.bitfire.davdroid.syncadapter.SyncManager.performSync(
at at.bitfire.davdroid.syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter.onPerformSync(
at android.content.AbstractThreadedSyncAdapter$
Caused by: java.lang.NumberFormatException: Invalid int: ""
at java.lang.Integer.invalidInt(
at java.lang.Integer.parseInt(
at java.lang.Integer.parseInt(
at java.lang.Integer.valueOf(


As a general remark, nextcould/owncloud problems are quite often the fault of "upstream", i.e. the *cloud calendar-app not generating valid files.

The title says it all: the VCARD is quite some garbage.

From RFC6350

The PREF parameter is OPTIONAL ... its value MUST be an integer between 1 and 100 that quantifies the level of preference.

       pref-param = "PREF=" (1*2DIGIT / "100")
                            ; An integer between 1 and 100.

So please refer to the nextcloud system.


I fully agree with you, that the entry is out of spec, and I deleted the "PREF=" tag. I believe it was another client setting the tag, not own-/nextcloud, as it was the only entry with that error in it.

However, I think that more users could have this issue. So rather than failing sync, I think it would be better practice to ignore that error and maybe issue a warning.
That will keep more users happy with DAVdroid.

(these errors are the reason why i tried an deinstalled DAVdroid before; CardDAV-Sync just syncs)


Please follow up here:

Temporal relations are not necessarily causal relations.

Log in to reply

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.