Sailfish keeps on duplicating contacts to Nextcloud

Since a few weeks my phone (XA2+, SFOS duplicates contacts, newly created on the phone, on my Nextcloud account. On the phone those contacts are fine, however there are now hundreds of entries of each of those contacts.

After activated extensive logging I see plenty of 412-Errors:

 unknown:0 - CardDAV sync for account:  22  finished with error: 412
[W] unknown:0 - QMetaObject::invokeMethod: No such method Syncer::syncFinishedWithError()
[W] unknown:0 - void CardDav::upsyncResponse() error: QNetworkReply::NetworkError(UnknownContentError) ( 412 )
[D] unknown:0 - "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
[D] unknown:0 - "<d:error xmlns:d=\"DAV:\" xmlns:s=\"\">"
[D] unknown:0 - "  <s:exception>Sabre\\DAV\\Exception\\PreconditionFailed</s:exception>"
[D] unknown:0 - "  <s:message>An If-Match header was specified and the resource did not exist</s:message>"
[D] unknown:0 - "  <s:header>If-Match</s:header>"
[D] unknown:0 - "</d:error>"

and plenty of those messages:

[D] unknown:0 -     "Content-Length" = "0"
[D] unknown:0 -     "If-Match" = "\"ca9c2698dce68348858b130585a3e89d\""
[D] unknown:0 - void NotebookSyncAgent::finalize() "22"
[D] unknown:0 - bool NotebookSyncAgent::applyRemoteChanges() "22"
[D] unknown:0 - generateUpsyncRequest(): "" QUrl("https://<myuser>@<mydomain>/remote.php/dav/addressbooks/users/<myuser>/contacts/9813ff2fbd9a46bba50b539d16505d5b.vcf") "DELETE" : 0 bytes

It shows that there’s something wrong and with each new sync I get 8 new entries.
Do you have any idea to hunt for the source of the problem?

1 Like

It seems I have the same problem. Contacts added via sailfishos over nextcloud are doubled. I have some that are a few hundred times now stored :expressionless:

Did I say few hundred? Over 3000 times the same entry!

Can you provide full logs maybe ? Expurge from private data.

Can you throw me the commands I have to enter, please? I have so much on my mind right now, I don’t have the time to figure it out myself :expressionless:

I’m in the irc channel as well, you can ping me and we can do a live debug session.

You can follow instructions from this page: CalDAV and CardDAV Community Contributions | Sailfish OS Documentation

Pardon me, but what instructions, specifically?
The page is pretty big and I cant find any

Also, can confirm. I’ve somehow got 38k contact, most being dupes

Just read the “Sync Logs” paragraph. There is no need to do the point 2. (no need for persistent journal logging), just stop the sync daemon and restart it manually in debug mode (point 3. and 4.), then perform a contact sync from the account setting page for instance.

Go back to normal by stopping the manually-started sync daemon. And start it again via systemctl.

Got to try and the log seems pretty darn extensive. Do you have any recomendations for cleaning?

Sorry, not specifically. Usely I deal with calendar sync log. They can become very long also, particularly with the dump of every transiting CalDAV entries. I guess it’s the same with CardDAV.

Keep the original with you and try to send a copy with all the CardDAV content removed. I guess the content is not an issue in your case. But try to keep all the other information, particularly the etag values if any. They may be responsible for the duplications.

I finally got around to look into the log. It is 2 MB big and really hard to render anonymous.

At first sight there’s some weird stuff going on, I’m not really sure about. msync gets a lot (over 4000…) of those messages:

[D] unknown:0 - " <d:response>"
[D] unknown:0 - " <d:status>HTTP/1.1 404 Not Found</d:status>"
[D] unknown:0 - " <d:href>/remote.php/dav/addressbooks/users/redacted/contacts/<32charlongid>.vcf</d:href>"
[D] unknown:0 - " <d:propstat>"
[D] unknown:0 - " <d:prop/>"
[D] unknown:0 - " <d:status>HTTP/1.1 418 I’m a teapot</d:status>"
[D] unknown:0 - " </d:propstat>"
[D] unknown:0 - " </d:response>"

But this doesn’t have to be related to the contact duplicating bug. It is possible that those are all the duplicated contacts I already deleted… the number could add up to it.

At the end it says

[W] unknown:0 - void CardDav::upsyncResponse() error: QNetworkReply::NetworkError(UnknownContentError) ( 412 )
[D] unknown:0 - “<?xml version=\"1.0\" encoding=\"utf-8\"?>”
[D] unknown:0 - “<d:error xmlns:d=“DAV:” xmlns:s=“">"
[D] unknown:0 - " <s:exception>Sabre\DAV\Exception\PreconditionFailed</s:exception>”
[D] unknown:0 - " <s:message>An If-Match header was specified and the resource did not exist</s:message>”
[D] unknown:0 - " <s:header>If-Match</s:header>"
[D] unknown:0 - “</d:error>”
[W] unknown:0 - CardDAV sync for account: 33 finished with error: 412

One interesting thing is, that might be the error or could be totally not relevant:

Every UID ends usually with &#13; BUT not the entries that are causing the problems. Is it possible that the addressbook doesn’t set the UID properly somehow and that irritates somewhere some part?

So. I’m not going to post the full log due to it being almost impossible to properly render it anonymous. But if you like to, we can have a debug session with desktop sharing and stuff and I can let you have a look at it directly.

I believe I have reported that issue two years back. At that time it helped to redo the NextCloud account on the phone. But after the next SFOS updated the bug was back.

1 Like

There’s an active bug report right now about it. We should get that fixed once and forever.

1 Like