# \`ContactCard/set\` stores a card without the mandatory \`uid\` when the client omits it

**URL:** https://support.stalw.art/t/contactcard-set-stores-a-card-without-the-mandatory-uid-when-the-client-omits-it/2444
**Category:** Issues
**Created:** [November 19, 2026, 4:27pm UTC](https://support.stalw.art/t/contactcard-set-stores-a-card-without-the-mandatory-uid-when-the-client-omits-it/2444 "2026-11-19T16:27:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![viertmuelle](https://support.stalw.art/letter_avatar_proxy/v4/letter/v/85e7bf/32.png) [@viertmuelle](https://support.stalw.art/u/viertmuelle)
#### Post date: [November 19, 2026, 4:27pm UTC](https://support.stalw.art/t/contactcard-set-stores-a-card-without-the-mandatory-uid-when-the-client-omits-it/2444/1 "2026-11-19T16:27:01Z")

</div>

### Issue Description

Stalwart 1.1.1, official Docker image, Linux x86\_64; reproduced on two installations. A `ContactCard/set` create without `uid` succeeds, and the card never gets one: `ContactCard/get` returns no `uid` even when asked for it, and the stored vCard has no `UID` line. RFC 9553 Section 2.1.9 defines `uid` as mandatory, and Section 1.3.3 says a mandatory property “MUST be set for an instance of this object to be valid”. `CalendarEvent/set` already handles the same case: an event created without `uid` gets a generated one.

### Expected Behavior

The server generates a `uid` (for example `urn:uuid:...`), as `CalendarEvent/set` does, and returns it in `ContactCard/get`. If it does not, it rejects the create with `invalidProperties`.

### Actual Behavior

The create returns `created`, and the card stays without `uid` over both JMAP and CardDAV. Group membership is keyed by `uid` (RFC 9553 Section 2.1.6, RFC 9610 Section 3), so such a card cannot be a member of any group. A client that leaves `uid` to the server loses every member it adds to a contact list, and gets no error.

### Reproduction Steps

One ordinary account with its default address book, `curl` and `jq`:

```bash
SRV=http://localhost:8080; USER=user@example.org; PW=userpass
U='["urn:ietf:params:jmap:core","urn:ietf:params:jmap:contacts"]'
jmap() { curl -s -u "$USER:$PW" -H 'Content-Type: application/json' -d '{"using":'"$U"',"methodCalls":[['"$1"',"0"]]}' "$SRV/jmap/" | jq -c '.methodResponses[0][1]'; }
ACC=$(curl -s -u "$USER:$PW" "$SRV/jmap/session" | jq -r '.primaryAccounts["urn:ietf:params:jmap:contacts"]')
BOOK=$(jmap '"AddressBook/get",{"accountId":"'"$ACC"'"}' | jq -r '.list[0].id')
create() { # $1 = creation id, $2 = extra properties
  jmap '"ContactCard/set",{"accountId":"'"$ACC"'","create":{"'"$1"'":{"@type":"Card","version":"1.0",
    "addressBookIds":{"'"$BOOK"'":true},"name":{"full":"'"$1"'"}'"$2"'}}}' | jq -r '.created["'"$1"'"].id // tojson'
}
A=$(create nouid ''); B=$(create withuid ',"uid":"urn:uuid:7a3c1d52-0d0e-4f4e-9a52-2b1c5e0f6a11"')
jmap '"ContactCard/get",{"accountId":"'"$ACC"'","ids":["'"$A"'","'"$B"'"],"properties":["uid","name"]}' | jq -c '.list[]'
# the stored vCards, over CardDAV
DAV="/dav/card/$(jq -rn --arg u "$USER" '$u|@uri')/default/"
curl -s -u "$USER:$PW" -X PROPFIND -H 'Depth: 1' "$SRV$DAV" | grep -o "<[a-zA-Z:]*href>[^<]*\.vcf\|<[a-zA-Z:]*href>$DAV[^<]\+" | sed 's/<[^>]*>//' | while read -r h; do
  curl -s -u "$USER:$PW" "$SRV$h" | tr -d '\r' | grep -E '^(FN|UID):' | paste -sd' '
done | sort

```

Output:

```auto
{"name":{"full":"nouid"},"id":"b"}
{"name":{"full":"withuid"},"uid":"urn:uuid:7a3c1d52-0d0e-4f4e-9a52-2b1c5e0f6a11","id":"c"}
FN:nouid
FN:withuid UID:urn:uuid:7a3c1d52-0d0e-4f4e-9a52-2b1c5e0f6a11

```

### Relevant Log Output

Trace level, create and read-back of the `nouid` card (client IP and auth header removed). No WARN or ERROR is logged:

```auto
DEBUG JMAP method call (jmap.method-call) command = "ContactCard/set", accountId = 293, elapsed = 6ms
TRACE HTTP response body (http.response-body) contents = "{\"methodResponses\":[[\"ContactCard/set\",{\"accountId\":\"jf\",\"oldState\":\"sae\",\"newState\":\"sai\",\"created\":{\"nouid\":{\"id\":\"b\"}}},\"0\"]],\"sessionState\":\"5c9c6af\"}"
TRACE HTTP response body (http.response-body) contents = "{\"methodResponses\":[[\"ContactCard/get\",{\"accountId\":\"jf\",\"state\":\"sam\",\"list\":[{\"name\":{\"full\":\"nouid\"},\"id\":\"b\"},{\"name\":{\"full\":\"withuid\"},\"uid\":\"urn:uuid:7a3c1d52-0d0e-4f4e-9a52-2b1c5e0f6a11\",\"id\":\"c\"}],\"notFound\":[]},\"0\"]],\"sessionState\":\"5c9c6af\"}"

```

### Stalwart Version

v1.x

### Installation Method

Docker

### Database Backend

RocksDB

### Blob Storage

RocksDB

### Search Engine

Internal

### Directory Backend

Internal

### Additional Context

Likely cause: the create path in `crates/jmap/src/contact/set.rs` converts the JSContact card to a vCard and passes `card.uid()` to `assert_is_unique_uid`, which checks only `if let Some(uid)`. Nothing fills in a missing `uid`. The create path in `crates/jmap/src/calendar_event/set.rs` does (`// Generate a UID when the client omitted one`, `generate_uid()`); the same step in the contact create path would fix this.

### 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

---

<div class="post-metadata">

### Author: ![stalwart](https://support.stalw.art/user_avatar/support.stalw.art/stalwart/32/12_2.png) [@stalwart](https://support.stalw.art/u/stalwart)
#### Post date: [November 21, 2026, 11:48am UTC](https://support.stalw.art/t/contactcard-set-stores-a-card-without-the-mandatory-uid-when-the-client-omits-it/2444/2 "2026-11-21T11:48:03Z")

</div>

This is fixed. A `ContactCard/set` create that leaves out `uid` (or sends `uid: null`) now gets a generated `urn:uuid:` value, the same way `CalendarEvent/set` already handled it. The generated value is written to the stored vCard as its `UID` line, it’s what `ContactCard/get` returns, and it’s reported in `created` next to the other server-set properties, so a client that leaves the uid to the server learns it from the create response and can use it for group membership straight away. A uid supplied by the client is kept as is and not echoed in `created`.

Cards that were already stored without a uid stay as they are. A client can still add a uid to one of them with a normal update.

The fix ships in the next weekly Stalwart release.
