\Recent flag when copying mail folders

Hi,

we migrated our IMAP server to Dovecot and I attempted to copy my maildirs from the old IMAP to the new one. While doing so, Dovecot replies with the foloowing error:

Append failed, server replied: A000047 BAD Error in IMAP command APPEND: Invalid system flag \\RECENT ( 0.001 + 0.000 secs ) . 

As a result, Akonadi won’t store the contained mails remotely but the folder has been created. That of course puts me in an invalid state. Sending the \Recent flag is wrong according to the RFC and Dovecot seems to be very strict about it. Is there a way or a fix to disable KMail / Akonadi from sending this flag?

My colleagues proposed to switch to Thunderbird and friends because there it just works. But I’ve been a KDE user for more than 20 years so switching is no option.

I am on Debian 13 with Kontact 6.3.3 (24.12.3).

Thank you

I have identified a fix in the KIMAP library which attempts to fix that issue. I applied that fix and rebuilt the Debian package and replaced the library. The severe errors are gone but Dovecot is till complaining with an internal error. Probably not related anymore to Akonadi or to the PIM suite but still very annoying. As I haven’t found much information online I might be the only one out there :slight_smile:

After this first step I got errors from time to time when copying directories:

org.kde.pim.akonadiserver: Error while handling command FetchCollections on connection akonadi_imap_resource_1 (0xaaaaf3056f80)
org.kde.pim.akonadiserver: Error while handling command FetchCollections on connection akonadi_imap_resource_1 (0xaaaaf3056f80)
org.kde.pim.imapresource: Got incomplete ancestor chain due to empty remoteId: Collection ID: 260    remote ID: "" 
    name: "" 
    url: QUrl("akonadi:?collection=260") 
    parent: -6515 "" 
    resource: "" 
    rights: QFlags<Akonadi::Collection::Right>(AllRights) 
    contents mime type: QList() 
    isVirtual: false 
     CachePolicy: 
    inherit: true 
    interval: -1 
    timeout: -1 
    sync on demand: false 
    local parts: QList() 
     CollectionStatistics:
       count: -1 
       unread count: -1 
       size: -1

There seems to be no way to recover other than restarting Arkonadi. I think I will give up for the moment as there is just too much involved in that issue I can cannot control right now.

Hi :waving_hand:

Yeah the recent flag fix has been pushed around 3 months ago, I’d guess it didn’t got released on your distro yet.

Concerning the errors it seems to indicate that some of your imap folders are missing a remoteId which shouldn’t happen. Could you check using akonadiconsole, browsing your imaps resource’s collections, if you have any folders without a remoteId ? You need to :

  • right click each folder,
  • select folder properties,
  • select the Internals tab.

If you don’t have any collections without a remoteId, but the error still appears when copying folder it might point a resource error.
I tried locally with both a cyrus and dovecor server and could not reproduce.

I’d guess it didn’t got released on your distro yet.

Right, its Debian stable, so I will be stuck on 2024.12 for some time. But I added the fix manually to the package, recompiled and replaced the library. That worked. Furthermore we had to disable METADATA support in Dovecot otherwise it will corrupt directories internally and refuse to store any mails with APPEND. Disabling that will prevent Akonadi (or KMail?) from sending SETMETADATA requests and allow Dovecot to continue copying. As we are using the Mailcow distribution, things are preconfigured and sometimes hard to track.

I am still puzzled that after 4 decades transferring emails still seems to be an issue. :sweat_smile:

Concerning the errors it seems to indicate that some of your imap folders are missing a remoteId which shouldn’t happen

I have checked all my folders and they have a removeId. I think it was related to the fact that I did not select a folder in the target account when dropping another folder there. I needed to restart Akonadi, select a folder and continue copying. That has worked and I am now at a stage where copying is done and I can start to work with my new account. I also need to add that I am talking about thousands of mails, 8 GB in total, distributed across hundreds of folders. With Akonadi you do not get much feedback about the status of synchronization (it was stuck a 0% all the time) and even if the server (Dovecot) denies APPENDing stuff, KMail still showed the folder and its new content. From a users perspective, you feel a bit lost in tracking issues. I understand the advantage of the component design and I also know how difficult all the local communication with all those components and feedback loops can be. In that particular issue it was hard for me to defend my decision to stick with Akonadi rather than using Thunderbird but I did and it is working right now as it should I think.

Thank you for your suggestions.