Deleted default calendar or address book reappears minutes later

Issue Description

When the default calendar or address book is deleted via the JMAP API, e.g. account page, the deletion reports success and the item is gone from the response. Several minutes later, however, the deleted item reappears as if it had never been deleted. This affects shared group accounts in particular, where the unwanted items become visible to every member again.

The use case of this is that I have several group accounts for shared mailboxes and several users that are members of those group accounts. Since I can’t delete the default calendar and address book of the group accounts, each user discovers dozens of unneccessary calendars and address books which clutters the clients.

Expected Behavior

A successful deletion via JMAP (or DAV) should be permanent. If a calendar or address book has been explicitly removed, it should stay removed until the admin or user creates a new one.

Actual Behavior

The server assumes that every account must have at least one calendar and at least one address book. Whenever it sees an account that has none, it silently recreates the configured default. This means an explicit deletion is undone the next time the account is touched, for example by a JMAP query, a CalDAV/CardDAV sync, the server processing an inbound calendar invite.

Reproduction Steps

  1. Take an account.
  2. Delete its default calendar and default address book via the JMAP API in the account page. Confirm success.
  3. Confirm the items are gone from the JMAP response.
  4. Wait a few minutes, then have any client access the account.
  5. Observe the deleted calendar and address book have returned.

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

This is documented, expected behavior rather than a bug: Stalwart auto-creates a default calendar and address book whenever an account has none, to keep CalDAV/CardDAV clients working out of the box. You can disable this by clearing defaultHrefName on the Calendar and AddressBook singletons for the affected accounts, which stops Stalwart from recreating a default one when none exists.

For your shared group accounts you’d want to clear defaultHrefName (leave it unset) on both the Calendar and AddressBook objects for each group account, so a deleted default is not automatically recreated. Note the docs say clients connecting to an account with zero calendars/address books will then get an appropriate error response instead of an auto-created one, so make sure your group accounts have at least the calendars/address books you actually want members to see.

See: Calendar | Stalwart and Contacts | Stalwart

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

defaultHrefName is not a per-account setting, it’s server wide. Clearing it in the server settings actually prevents the creation, so it works as a workaround. A per-account option would still be appreciated, but for now has no priority for me.

So this could be moved to Feature Ideas.