Bug 402258

Summary: fatal error "could not create collection outbox, resourceId: 7"
Product: [Applications] kmail2 Reporter: Zion Nimchuk <zionnimchuk>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: REPORTED ---    
Severity: normal CC: aspotashev, kde, nico.cys, sergio, zionnimchuk
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Output when launching kmail from the terminal
akonadiserver log

Description Zion Nimchuk 2018-12-17 19:54:48 UTC
Created attachment 116973 [details]
Output when launching kmail from the terminal

SUMMARY

I restarted my computer after the update from 18.08.3 to 18.12.0, and KMail asked if I wanted to unify my mailboxes or something like that, and I clicked yes. The next time I restarted, I got the "could not create collection outbox, resourceId: 7" fatal error

OBSERVED RESULT

Fatal error and unable to use mail client.

EXPECTED RESULT

mail client launched as normal.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 5.14.4
KDE Frameworks Version: 5.53.0
Qt Version: 5.12.0

ADDITIONAL INFORMATION

kmail2 5.10.1
Comment 1 Nicolas 2018-12-24 08:46:44 UTC
Can confirm here, but with resourceID 10, after the same sequence of events.

Journalctl provides the relevant information:

akonadiserver[878]: org.kde.pim.akonadiserver: DATABASE ERROR:
akonadiserver[878]: org.kde.pim.akonadiserver:   Error code: "1062"
akonadiserver[878]: org.kde.pim.akonadiserver:   DB error:  "Duplicate entry '4-outbox' for key 'CollectionTable_parentAndNameIndex'"
akonadiserver[878]: org.kde.pim.akonadiserver:   Error text: "Duplicate entry '4-outbox' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
akonadiserver[878]: org.kde.pim.akonadiserver:   Values: QMap((":0", QVariant(QString, ""))(":1", QVariant(QString, ""))(":10", QVariant(int, -1))(":11", QVariant(int, -1))(":12", QVariant(bool, false))(":13", QVariant(QString, ""))(":14", QVariant(bool, false))(":2", QVariant(QString, "outbox"))(":3", QVariant(qlonglong, 4))(":4", QVariant(qlonglong, 10))(":5", QVariant(bool, true))(":6", QVariant(int, 2))(":7", QVariant(int, 2))(":8", QVariant(int, 2))(":9", QVariant(bool, true)))
akonadiserver[878]: org.kde.pim.akonadiserver:   Query: "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, enabled, syncPref, displayPref, indexPref, cachePolicyInherit, cachePolicyCheckInterval, cachePolicyCacheTimeout, cachePolicySyncOnDemand, cachePolicyLocalParts, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14)"
Comment 2 kde 2019-03-21 07:29:19 UTC
Created attachment 118956 [details]
akonadiserver log
Comment 3 kde 2019-03-21 07:31:52 UTC
Same problem here. I'm not sure whether it is version specific.

Some background: I have a bunch of filters that move emails into folders. Some months ago I noticed that they started playing up. They were pointing to different destination folders. Each time a filter got "corrupted" I reselected the correct destination folder.

About 2 weeks ago a similar thing happened with  sent messages - in my account settings I have configured that Sent messages gets put into Inbox (rather than into Sent) - when I went into the account I saw that it was pointing to some other folder, I corrected it by pointing it back to Inbox. So this was working for a few days until there was kmail update. After update kmail no longer starts and gives the error:

org.kde.pim.akonadicore: Failed SpecialCollectionsRequestJob::slotResult "Could not create collection outbox, resourceId: 16"
org.kde.pim.mailcommon: "The Email program encountered a fatal error and will terminate now.\nThe error was:\nCould not create collection outbox, resourceId: 16"

My guess is that there is a bug or something that is changing/corrupting the resourceId of folders, which is why my filters are pointing to different folders.

Is there a quick fix for this? IE a workaround to fix the "Could not create collection outbox" so that I can continue to use kmail whilst the bug is tracked down. Right now I having to use webmail which is not as convenient.
Comment 4 Sérgio Basto 2019-04-24 02:17:27 UTC
Same here after update from Fedora 28 to Fedora 29 

org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "1062"
org.kde.pim.akonadiserver:   DB error:  "Duplicate entry '7-outbox' for key 'CollectionTable_parentAndNameIndex'"
org.kde.pim.akonadiserver:   Error text: "Duplicate entry '7-outbox' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
org.kde.pim.akonadiserver:   Values: QMap((":0", QVariant(QString, ""))(":1", QVariant(QString, ""))(":10", QVariant(int, -1))(":11", QVariant(int, -1))(":12", QVariant(bool, false))(":13", QVariant(QString, ""))(":14", QVariant(bool, false))(":2", QVariant(QString, "outbox"))(":3", QVariant(qlonglong, 7))(":4", QVariant(qlonglong, 5))(":5", QVariant(bool, true))(":6", QVariant(int, 2))(":7", QVariant(int, 2))(":8", QVariant(int, 2))(":9", QVariant(bool, true)))
org.kde.pim.akonadiserver:   Query: "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, enabled, syncPref, displayPref, indexPref, cachePolicyInherit, cachePolicyCheckInterval, cachePolicyCacheTimeout, cachePolicySyncOnDemand, cachePolicyLocalParts, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14)"
org.kde.pim.akonadiserver: Error during insertion into table "CollectionTable" "Duplicate entry '7-outbox' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
org.kde.pim.akonadicore: Failed SpecialCollectionsRequestJob::slotResult "Could not create collection outbox, resourceId: 5"
Comment 5 Sérgio Basto 2019-06-08 00:48:18 UTC
Hi, look likes https://forum.kde.org/viewtopic.php?t=120777


cd ~/.kde/share/apps/kmail/mail


and remove outbox folder for example with :


mv outbox/ ~
Comment 6 Nicolas 2019-06-11 06:44:06 UTC
That worked for me, after deleting both the outbox and the templates folders in .local/share/local-mail/