Bug 508107

Summary: Kontact/Kmail does not fetch emails from servers and can't send messages.
Product: [Applications] kontact Reporter: Adam Jimerson <vendion>
Component: mailAssignee: kdepim bugs <kdepim-bugs>
Status: REPORTED ---    
Severity: normal CC: goliash
Priority: NOR    
Version First Reported In: 6.4.3   
Target Milestone: ---   
Platform: NixOS   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot of Kontact in email view
Screenshot of Kontact in email view
Screenshot of Kontact in email view
Output from FSCK on Akonadi DB
Output from vacuum on Akonadi DB

Description Adam Jimerson 2025-08-11 12:26:37 UTC
Created attachment 183948 [details]
Screenshot of Kontact in email view

SUMMARY
After opening Kontact/Kmail (happens in both), I can see that it tries to connect to all my email accounts via IMAP (a mix of Google, Proton, and self-hosted email accounts) but nothing is actually fetched and there is no visible error. Furthermore, all emails that were previously fetch are not visible in the UI, instead I just get an empty list. The only time I get an actual error is when I try sending an email, or when doing a Akonadi fsck. This started after updating Plasma to 6.4.4.

STEPS TO REPRODUCE
1. Have IMAP accounts configured
2. Try to open a folder for said account to view emails
3. Try to fetch new messages from server
4. Try to send an email

OBSERVED RESULT
Viewing already fetched emails or checking for new emails silently fails, sending emails gives an error about not being able to insert something into the database, and fsck on the database has errors.

EXPECTED RESULT
It should be able to view emails, fetch new emails, and send emails.

SOFTWARE/OS VERSIONS
Operating System: NixOS 25.11
KDE Plasma Version: 6.4.4
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
Kernel Version: 6.15.9-xanmod1 (64-bit)
Graphics Platform: Wayland


ADDITIONAL INFORMATION
Comment 1 Adam Jimerson 2025-08-11 12:27:18 UTC
Created attachment 183949 [details]
Screenshot of Kontact in email view
Comment 2 Adam Jimerson 2025-08-11 12:29:11 UTC
Created attachment 183950 [details]
Screenshot of Kontact in email view
Comment 3 Adam Jimerson 2025-08-27 14:21:20 UTC
Quick update: it seems the issue may be due to the Akodoni DB; it appears that it keeps getting corrupt, and running an fcsk and a vacuum doesn't resolve the isuse.

kf.calendarcore: parse error from icalcomponent_new_from_string. string= "This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client."
kf.calendarcore: "/home/vendion/.cache/akonadi_ical_resource_1/akonadi_ical_resource_1"  is not a valid iCalendar file
kf.calendarcore: parse error from icalcomponent_new_from_string. string= "This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client."
kf.calendarcore: "/home/vendion/.cache/akonadi_ical_resource_1/akonadi_ical_resource_1"  is not a valid iCalendar file
kf.calendarcore: Error parsing vCalendar file: syntax error at line 1
kf.calendarcore: Error parsing vCalendar file: pop on empty Object Stack
 at line 1
kf.calendarcore: "/home/vendion/.cache/akonadi_ical_resource_1/akonadi_ical_resource_1"  is not a valid vCalendar file.  exception code  7
kf.calendarcore: "/home/vendion/.cache/akonadi_ical_resource_1/akonadi_ical_resource_1"  is not a valid xCalendar file.  exception code  19 QList("Start tag expected.")
akonadi_ical_resource: Error loading file  "/home/vendion/.cache/akonadi_ical_resource_1/akonadi_ical_resource_1"
org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "1034"
org.kde.pim.akonadiserver:   DB error:  "Index for table 'pimitemtable' is corrupt; try to repair it"
org.kde.pim.akonadiserver:   Error text: "Index for table 'pimitemtable' is corrupt; try to repair it QMYSQL: Unable to store statement results"
org.kde.pim.akonadiserver:   Values: QList(QVariant(qlonglong, 129), QVariant(QString, "20200101_q8ue475rr4p7opsd4c0lr7g5pg"))
org.kde.pim.akonadiserver:   Query: "SELECT PimItemTable.id, PimItemTable.rev, PimItemTable.remoteId, PimItemTable.remoteRevision, PimItemTable.gid, PimItemTable.collectionId, PimItemTable.mimeTypeId, PimItemTable.datetime, PimItemTable.atime, PimItemTable.dirty, PimItemTable.size FROM PimItemTable WHERE ( collectionId = :0 AND ( ( remoteId = :1 ) ) ) FOR UPDATE"
org.kde.pim.akonadiserver: Error while handling command CreateItem on connection akonadi_google_resource_2 (0x3de05020)
org.kde.pim.akonadicore: Deleting items from the akonadi database failed: ""
org.kde.pim.akonadicore: Creating/updating items from the akonadi database failed: "Failed to query database for item"
org.kde.pim.akonadicore: Error during ItemSync:  "Failed to query database for item"
org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "1034"
org.kde.pim.akonadiserver:   DB error:  "Index for table 'pimitemtable' is corrupt; try to repair it"
org.kde.pim.akonadiserver:   Error text: "Index for table 'pimitemtable' is corrupt; try to repair it QMYSQL: Unable to store statement results"
org.kde.pim.akonadiserver:   Values: QList(QVariant(qlonglong, 1), QVariant(qlonglong, 2), QVariant(qlonglong, 129))
org.kde.pim.akonadiserver:   Query: "SELECT count(DISTINCT PimItemTable.id), sum(PimItemTable.size), sum(CASE WHEN ( SeenFlags.Flag_id IS NOT NULL OR IgnoredFlags.Flag_id IS NOT NULL ) THEN 1 ELSE 0 END) FROM PimItemTable LEFT JOIN PimItemFlagRelation AS SeenFlags ON ( PimItemTable.id = SeenFlags.PimItem_id AND SeenFlags.Flag_id = :0 ) LEFT JOIN PimItemFlagRelation AS IgnoredFlags ON ( PimItemTable.id = IgnoredFlags.PimItem_id AND IgnoredFlags.Flag_id = :1 ) WHERE ( collectionId = :2 )"
org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "1034"
org.kde.pim.akonadiserver:   DB error:  "Index for table 'pimitemtable' is corrupt; try to repair it"
org.kde.pim.akonadiserver:   Error text: "Index for table 'pimitemtable' is corrupt; try to repair it QMYSQL: Unable to store statement results"
org.kde.pim.akonadiserver:   Values: QList(QVariant(qlonglong, 77), QVariant(QString, "761546"))
org.kde.pim.akonadiserver:   Query: "SELECT PimItemTable.id, PimItemTable.rev, PimItemTable.remoteId, PimItemTable.remoteRevision, PimItemTable.gid, PimItemTable.collectionId, PimItemTable.mimeTypeId, PimItemTable.datetime, PimItemTable.atime, PimItemTable.dirty, PimItemTable.size FROM PimItemTable WHERE ( collectionId = :0 AND ( ( remoteId = :1 ) ) ) FOR UPDATE"
org.kde.pim.akonadiserver: Error while handling command CreateItem on connection akonadi_imap_resource_0 (0x7f0f90009b40)
org.kde.pim.akonadicore: ""
org.kde.pim.akonadicore: Creating/updating items from the akonadi database failed: "Failed to query database for item"
org.kde.pim.akonadicore: Error during ItemSync:  "Failed to query database for item"
org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "1034"
org.kde.pim.akonadiserver:   DB error:  "Index for table 'pimitemtable' is corrupt; try to repair it"
org.kde.pim.akonadiserver:   Error text: "Index for table 'pimitemtable' is corrupt; try to repair it QMYSQL: Unable to store statement results"
org.kde.pim.akonadiserver:   Values: QList(QVariant(qlonglong, 1), QVariant(qlonglong, 2), QVariant(qlonglong, 77))
org.kde.pim.akonadiserver:   Query: "SELECT count(DISTINCT PimItemTable.id), sum(PimItemTable.size), sum(CASE WHEN ( SeenFlags.Flag_id IS NOT NULL OR IgnoredFlags.Flag_id IS NOT NULL ) THEN 1 ELSE 0 END) FROM PimItemTable LEFT JOIN PimItemFlagRelation AS SeenFlags ON ( PimItemTable.id = SeenFlags.PimItem_id AND SeenFlags.Flag_id = :0 ) LEFT JOIN PimItemFlagRelation AS IgnoredFlags ON ( PimItemTable.id = IgnoredFlags.PimItem_id AND IgnoredFlags.Flag_id = :1 ) WHERE ( collectionId = :2 )"
org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "1034"
org.kde.pim.akonadiserver:   DB error:  "Index for table 'pimitemtable' is corrupt; try to repair it"
org.kde.pim.akonadiserver:   Error text: "Index for table 'pimitemtable' is corrupt; try to repair it QMYSQL: Unable to store statement results"
org.kde.pim.akonadiserver:   Values: QList(QVariant(qlonglong, 5))
org.kde.pim.akonadiserver:   Query: "SELECT PimItemTable.id, PimItemTable.remoteId, PimItemTable.mimeTypeId, PimItemTable.rev, PimItemTable.remoteRevision, PimItemTable.size, PimItemTable.datetime, PimItemTable.c
Comment 4 Adam Jimerson 2025-08-27 14:22:01 UTC
Created attachment 184500 [details]
Output from FSCK on Akonadi DB
Comment 5 Adam Jimerson 2025-08-27 14:22:29 UTC
Created attachment 184501 [details]
Output from vacuum on Akonadi DB