Your question
When a user logs in, I’ll check if there is already a push subscription for him, if not I create one expiring in 2days.
If there is a push subscription and it’s expiring in less then 1 day, I try to update it’s expiration to a date in 2days from now. But I get the following response from the server:
{
"methodResponses":[
["PushSubscription/set",{
"accountId":"b",
"notCreated":{
"2d24fa89ace9f3fc1863cdc34782f6c5":{
"type":"invalidProperties",
"description":"Field could not be set.",
"properties":["expires"]
}
}
},"0"]
],
"sessionState":"a5401889"
}
The JMAP Push Tutorial describes it that way.
Does Stalwart not allow updating it and why?
What should I do instead, create a new one and let the old expire …
Ralf
The source code tells the full story. Looking at the validate_push_value function, the expires property is handled correctly – it accepts both a date value and null. The error you’re seeing (“Field could not be set”) is actually the catch-all fallback at the bottom of that match statement, meaning the value you’re sending for expires doesn’t match the expected format.
Specifically, the code expects expires to be sent as either:
- A
Value::Element(PushSubscriptionValue::Date(...)) – a proper UTC date/time string
Value::Null – which will set it to the maximum allowed expiry (7 days from now)
The most likely cause of your invalidProperties error is that the expires value in your update request isn’t being parsed as a valid UTC date. Double-check that it’s a properly formatted ISO 8601 date-time string (e.g., "2025-07-01T12:00:00Z").
Also note from the source:
- The maximum expiry is capped at 7 days from the current time (
EXPIRES_MAX = 7 * 24 * 3600). If you request more than 7 days, it will silently be clamped to 7 days.
- Sending
"expires": null in your update is a clean way to reset the expiry to the maximum (7 days), without needing to calculate and format the date yourself.
So rather than destroying and recreating the subscription, just send a PushSubscription/set update with "expires": null – that is a valid update operation and will extend the expiry to the maximum allowed.
This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.
Ok, it was the date-format 
Thx