kdav does not sync correctly - 500 internal Server Error

  • Hello all,

    we installed kdav on us kopano Server on UCS. It works with accounts with a few contacts, but with the central address book with over 400 contacts, we get an error. But don’t know what is to do, or where is the issue. Here is the end of the Log:

    25.07.2019 21:47:15 [16920] [TRACE]  dav KopanoDavBackend->GetMapiMessageForId(): Try PR_SOURCE_KEY a9a78371807b4
    25.07.2019 21:47:15 [16920] [TRACE]  dav KopanoDavBackend->GetStore(): storename gemeinsam-firma
    25.07.2019 21:47:15 [16920] [TRACE]  dav KopanoDavBackend->GetStore(): storename gemeinsam-firma
    25.07.2019 21:47:15 [16920] [TRACE]  dav KopanoDavBackend->GetIdOfMapiMessage(): Finding ID of Resource id #523
    25.07.2019 21:47:15 [16920] [DEBUG]  dav KopanoDavBackend->GetIdOfMapiMessage(): Found PR_SOURCE_KEY: a9a78371807
    25.07.2019 21:47:15 [16920] [TRACE] card KopanoCardDavBackend->getCard(): returned data id: a9a78371807b4a5db7856
    25.07.2019 21:47:15 [16920] [DEBUG] main KLogger->LogOutgoing(): OUTPUT:
    HTTP/1.1 500 Internal Server Error
    X-KDAV-Version: GIT
    X-Sabre-Version: 3.2.2
    Content-Type: application/xml; charset=utf-8
    <?xml version="1.0" encoding="utf-8"?>
    <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
      <s:message>This parser can only read from strings or streams.</s:message>
    25.07.2019 21:47:15 [16920] [DEBUG] main httpcode='500' memory='8.68 MiB/10.00 MiB' time='4.33s'
    25.07.2019 21:47:15 [16920] [DEBUG] main ------------------ End

    Git Version from 22.7.2019

  • Kopano

    Hi boospy,

    could you post the complete log? What client is accessing kdav?


  • Log Attached.

    If i open some path directly


    I get this messagebox in the webbrowser:

    <d:error><s:sabredav-version>3.2.2</s:sabredav-version><s:exception>Sabre\VObject\ParseException</s:exception><s:message>Invalid Mimedir file. Line starting at 10 did not follow iCalendar/vCard conventions</s:message></d:error>

    This is the last one in the list. So i think there is the error. But how i can identify what contact this is?
    All other are ok.

    The Brower ask me for Download.
  • Kopano

    Hi boospy,

    so, only the last contact from the list doesn’t work, is that right?

    Which Kopano version are you using?

    Are there any errors in apache logs?


  • How much max ram are you allowing to php?

  • Hello,

    i have the same problem. All configured like the default. -> PHP Ram 256M.
    I have 300 contacts, some with photo. It this error a ram problem? or invalid vcards?

    I’ve deleted some of the contacts that are experiencing the problem, but this is an infinite story.

  • Kopano

    Hi proficleaner,

    “same problem” is a very vague description.

    Which versions of kdav, Kopano, OS are you using?

    Are you able to open some contacts in the browser and some not? Or are you using some other client?

    Are there any errors in kdav and apache logs?


  • Sorry for the late reply. I didn’t get any notification.

    No Apache Errors. There are definitely bad contacts, i have delete all contacts an imported 5 for test. It is working fine. But as error i see only that xml, not the id of the bad vcards. Memory Limit is @128MB should i increase that?

  • So, i’ve setuped here a brand new kopanoserver with subscription, so with actual packages. I’ve install kdav. What have i tested:

    • Sync with KDE’s Kontact
    • Sync with Android’s davX5

    On Kontact i never seen any addressbookentry. On Android some files are synced, about 15 of 40. After changing a few contacts, 3 or 6 more were synced. Really strange, whats going wrong here? Have anyone the plugin successfully running? It would help a lot. Because the contactpicture issue. Zpush damage all pictures, so nice big pictures, are reduced in unusable quality. The kopano support talked to the zpush dev’s, they known about the issue, but they can’t find the reason.

    All logs from the sync are here, maybe someone can help me to configure the plugin right.
    https://darkdevil.osit.cc/index.php/s/eEcJASaynDLrmyG?path=%2Fshares for forums%2FKdav-Logs

    Very thanks

  • Kopano

    Hi @boospy,

    please update KDAV to the latest master branch version. I’ve added more logging in order to figure out why sabre is complaining about line 12 in the generated vcard data.


  • Thanks for the information. I give this to us dev.

  • I encountered the same problem. I don’t know if it’s for the same reason. We finally found out that the user had an Adresslist entry in his Kopano-Contacts and this caused the error. Once removed it worked.

    After a little debugging, i saw that an Addresslist item returns an empty VCF (strlen 0) and SabreDAV does not handle it. So i simple added those three lines

    if ($r['size']==0) {
                return false;

    just before the return of the public function getCard($addressBookId, $cardUri, $mapifolder = null) (around line 199 in the actual code) of lib/KopanoCardDavBackend.php.

    Perhaps this helps someone out…


  • Sorry, but we give up with this. To much time, did not work.

  • The 500 Internal Server Error is the general catch all error when the server throws an exception. The first thing you need to know about an “Internal Server Error” is that the error can only be resolved by fixes to the Web server software. It is not a client-side problem meaning that the problem is not with your browser, your computer, or your internet connection. There are a number of causes for a 500 Internal Server Error to display in a web browser. Consider some debugging tips to help diagnose and fix common causes of this problem.

    • Refresh the URL that you have requested. The error may be for the short term.
    • Clear all the website cache from your web browser
    • Delete website cookies because error 500 can be obstructed by clearing the website cookies. Restart your web browser after clearing cookies.
    • Create a new .htaccess file. Sometimes the incorrect code and command in .htaccess file cause error 500 on the website. Rename the file with another name; it will automatically become invalid. Then create a new .htaccess file and upload it to the server.
    • Finally, Ask your Hosting Provider