Issue Description
Hi all,
i hope AI supported bug reports are not frowned upon. But this caused already multiple times issues on my productive setup.
Bug Report: CalDAV Recurrence Override VEVENT Missing Mandatory DTSTART
Summary
When an iCalendar .ics resource is requested over CalDAV for a recurring event that contains recurrence overrides, Stalwart serializes the override as a secondary BEGIN:VEVENT ... END:VEVENT block containing RECURRENCE-ID but completely missing DTSTART.
This violates RFC 5545 §3.6.1 and causes strict CalDAV clients (such as DAVx5 on Android) to fail parsing with ResourceMappingException: Missing DTSTART in VEVENT, aborting the entire calendar synchronization.
Environment
- Stalwart Version:
v0.16.27(Docker imagestalwartlabs/stalwart:v0.16-alpine) - Protocol: CalDAV (
/dav/cal/...) - Client: DAVx5 (Android,
at.bitfire.synctools)
Steps to Reproduce
- Create a recurring event on Stalwart (e.g., weekly on Mondays at 09:00 UTC).
- Modify a single instance of the event (or receive an attendee RSVP / update from an external mail client like Outlook or Apple Calendar) where:
- The instance start time is not changed.
- Another property is changed (e.g., title, description, or attendee participation status).
- In Stalwart’s internal JMAP representation, this produces a
recurrenceOverridesmap where the partial object legitimately omitsstart(per RFC 8984 §4.1.3, sincestartdefaults to the recurrence occurrence timestamp). - Fetch the
.icsresource via CalDAV:GET /dav/cal/<user>/default/<event-uid>.ics HTTP/1.1 Host: mail.example.com Authorization: Basic ...
Observed Behavior
Stalwart returns an iCalendar object where the overridden instance VEVENT lacks DTSTART:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Stalwart Labs//Stalwart Mail Server//EN
BEGIN:VEVENT
UID:2117ae7d-9f5f-45a7-b4ea-3bac225c716b
DTSTART:20261015T090000Z
DURATION:PT1H
RRULE:FREQ=WEEKLY;BYDAY=MO
SUMMARY:Team Sync
...
END:VEVENT
BEGIN:VEVENT
UID:2117ae7d-9f5f-45a7-b4ea-3bac225c716b
RECURRENCE-ID:20261022T090000Z
SUMMARY:Team Sync (Agenda Updated)
...
END:VEVENT
END:VCALENDAR
Notice that the secondary VEVENT with RECURRENCE-ID:20261022T090000Z does not contain a DTSTART line.
Client Impact (DAVx5 Exception Log)
DAVx5 uses bitfire synctools, which strictly validates RFC compliance. The synchronization worker crashes with:
at.bitfire.synctools.exception.ResourceMappingException: Missing DTSTART in VEVENT
at androidx.work.OperationKt.requireDtStart(r8-map-id-...:27)
at at.bitfire.synctools.mapping.calendar.builder.UidBuilder.build(r8-map-id-...:45)
at at.bitfire.davdroid.sync.JtxSyncManager.processICalendar(r8-map-id-...:563)
at androidx.glance.session.SessionWorker$doWork$2$2.invokeSuspend(r8-map-id-...:421)
...
REMOTE RESOURCE
https://mail.example.com/dav/cal/<user>/default/2117ae7d-9f5f-45a7-b4ea-3bac225c716b.ics
Because of this exception, calendar synchronization halts completely and subsequent events are not downloaded to the mobile device.
Specification Analysis (RFC 5545 vs RFC 8984)
-
RFC 5545 §3.6.1 (Event Component):
“The following is REQUIRED if the component is an exception to a recurring ‘VEVENT’ calendar component: recurrence-id”
“The following is REQUIRED if the event is not a recurrent event: dtstart”
“The following is REQUIRED if the event is a recurrent event …: dtstart”
In iCalendar, every
VEVENTcomponent must have aDTSTARTproperty, including exception components with aRECURRENCE-ID. -
RFC 8984 §4.1.3 (JSCalendar / JMAP recurrenceOverrides):
“The value is a PartialCalendarEvent object, which is a Map of property names from the CalendarEvent object … to the overridden value … When evaluating a recurrence override, the properties of the PartialCalendarEvent override the corresponding properties of the master CalendarEvent object.”
In JMAP / JSCalendar, omitting
startfrom a recurrence override is valid because it inherits the recurrence instance start time. -
Root Cause:
When Stalwart’s JMAP-to-iCalendar exporter serializesrecurrenceOverrides, it only generates aDTSTARTproperty ifoverride.start != null. Whenoverride.startis null, it fails to fall back to the recurrence instance key (RECURRENCE-ID).
Proposed Fix
In Stalwart’s iCalendar serialization logic (where recurrenceOverrides entries are turned into VEVENT components):
- Check if the override object contains an explicit
startproperty. - If
startis null or omitted, deriveDTSTARTfrom therecurrenceOverrideskey (RECURRENCE-ID). - Similarly, ensure
DURATIONorDTENDfalls back to the master event’s duration if not overridden.
Workaround
Updating the JMAP event directly via CalendarEvent/set to explicitly populate "recurrenceOverrides/<recurrenceId>/start" resolves the issue immediately and allows CalDAV clients to resume sync:
{
"using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:calendars"],
"methodCalls": [
[
"CalendarEvent/set",
{
"accountId": "<account-id>",
"update": {
"<event-id>": {
"recurrenceOverrides/<recurrence-id>/start": "<recurrence-id>",
"recurrenceOverrides/<recurrence-id>/duration": "PT1H"
}
}
},
"c0"
]
]
}
Stalwart Version
v0.16.x
Installation Method
Docker
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
Internal
I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
on
I have searched this support forum (open and closed topics) and confirm this is not a duplicate.
on
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on