Sometime in the last couple of years Nextcloud made some changes to the Contacts app. They added a system address book, and the ability to have multiple address books under a single Nextcloud account.
iOS sort of supports multiple address books under one account, but this has some unintended side effects. The additional address books show up as groups in the iOS Contacts app, and this marks the account as unavailable to be set as the default account for saving contacts. As I’m writing this, that’s probably because the system address book isn’t writable, and iOS requires a default account to be writable. I suppose that makes sense.
In modern versions of Nextcloud, there’s a toggle to Enable System Address Book in Administration -> Groupware -> System Address Book that disables it from appearing in CardDAV.
In older versions, you need to run a occ command:
occ config:app:set dav system_addressbook_exposed --value="no"
This wouldn’t be as big of an issue if iOS didn’t rewrite CardDAV URLs to
/principals/ which retrieves all available address books. Even when you
specify a CardDAV URL like:
https://cloud.example.com/remote.php/dav/addressbooks/users/prplecake/contacts/
it will get rewritten to:
https://cloud.example.com/remote.php/dav/principals/users/prplecake/
Bonkers. This isn’t an issue on macOS Sequoia.