Deleting clusternodes gives error message

Issue Description

When trying to delete a clusternode I get an error message.

$ docker run --rm -e STALWART_URL=:8080 -e STALWART_TOKEN=API_ stalwartlabs/cli query ClusterNode
Id Node ID Hostname Last Renewal Status
a 0 stalwart 2026-07-17T13:04:17Z Active
b 1 stalwart-node-2 2026-07-17T06:36:11Z Stale
c 2 mx1. 2026-07-17T13:18:33Z Active
d 3 “mx1.” 2026-07-17T06:43:21Z Stale
e 4 “mx2.” 2026-07-17T06:44:08Z Stale
f 5 mx2. 2026-07-17T12:48:12Z Active

$ docker run --rm -e STALWART_URL=:8080 -e STALWART_TOKEN=API_ stalwartlabs/cli delete ClusterNode --ids 1,3,4 --debug
[debug] → GET http://:8080/api/schema
[debug] ← GET http://:8080/api/schema status=302 Found content-type=(none) content-length=0 content-encoding=identity
[debug] → GET http://:8080/api/schema/
[debug] ← GET http://:8080/api/schema/ status=200 OK content-type=application/json content-length=148000 content-encoding=gzip
[debug] → GET http://:8080/jmap/session
[debug] ← GET http://:8080/jmap/session status=200 OK content-type=application/json; charset=utf-8 content-length=1739 content-encoding=identity
[debug] → POST http://:8080/jmap
[debug] ← POST http://:8080/jmap status=200 OK content-type=application/json; charset=utf-8 content-length=263 content-encoding=identity
1 failed: error: forbidden
Telemetry objects cannot be deleted
3 failed: error: forbidden
Telemetry objects cannot be deleted
4 failed: no response from server
0 deleted, 3 failed
error: one or more deletions failed

Expected Behavior

The clusternode should be deleted.

Actual Behavior

The request is denied with the message “1 failed: error: forbidden
Telemetry objects cannot be deleted”.

Reproduction Steps

$ docker run --rm -e STALWART_URL=:8080 -e STALWART_TOKEN=API_ Package cli · GitHub query ClusterNode
Id Node ID Hostname Last Renewal Status
a 0 stalwart 2026-07-17T13:04:17Z Active
b 1 stalwart-node-2 2026-07-17T06:36:11Z Stale
c 2 mx1. 2026-07-17T13:18:33Z Active
d 3 “mx1.” 2026-07-17T06:43:21Z Stale
e 4 “mx2.” 2026-07-17T06:44:08Z Stale
f 5 mx2. 2026-07-17T12:48:12Z Active

$ docker run --rm -e STALWART_URL=:8080 -e STALWART_TOKEN=API_ Package cli · GitHub delete ClusterNode --ids 1,3,4 --debug
[debug] → GET http://:8080/api/schema
[debug] ← GET http://:8080/api/schema status=302 Found content-type=(none) content-length=0 content-encoding=identity
[debug] → GET http://:8080/api/schema/
[debug] ← GET http://:8080/api/schema/ status=200 OK content-type=application/json content-length=148000 content-encoding=gzip
[debug] → GET http://:8080/jmap/session
[debug] ← GET http://:8080/jmap/session status=200 OK content-type=application/json; charset=utf-8 content-length=1739 content-encoding=identity
[debug] → POST http://:8080/jmap
[debug] ← POST http://:8080/jmap status=200 OK content-type=application/json; charset=utf-8 content-length=263 content-encoding=identity
1 failed: error: forbidden
Telemetry objects cannot be deleted
3 failed: error: forbidden
Telemetry objects cannot be deleted
4 failed: no response from server
0 deleted, 3 failed
error: one or more deletions failed

Relevant Log Output

$ docker run --rm   -e STALWART_URL=<snip>:8080   -e STALWART_TOKEN=API_<snip>   ghcr.io/stalwartlabs/cli delete ClusterNode --ids 1,3,4 --debug
[debug] -> GET http://<snip>:8080/api/schema
[debug] <- GET http://<snip>:8080/api/schema status=302 Found content-type=(none) content-length=0 content-encoding=identity
[debug] -> GET http://<snip>:8080/api/schema/<snip>
[debug] <- GET http://<snip>:8080/api/schema/<snip> status=200 OK content-type=application/json content-length=148000 content-encoding=gzip
[debug] -> GET http://<snip>:8080/jmap/session
[debug] <- GET http://<snip>:8080/jmap/session status=200 OK content-type=application/json; charset=utf-8 content-length=1739 content-encoding=identity
[debug] -> POST http://<snip>:8080/jmap
[debug] <- POST http://<snip>:8080/jmap status=200 OK content-type=application/json; charset=utf-8 content-length=263 content-encoding=identity
1 failed: error: forbidden
    Telemetry objects cannot be deleted
3 failed: error: forbidden
    Telemetry objects cannot be deleted
4 failed: no response from server
0 deleted, 3 failed
error: one or more deletions failed

Stalwart Version

v0.16.x

Installation Method

Docker

Database Backend

PostgreSQL

Blob Storage

S3-compatible

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 confirms it’s by design: ClusterNode is grouped in the source code with Log, Metric, and Trace as a “telemetry” object type, and the server explicitly rejects create/update/destroy operations on all of these via the JMAP set handler, regardless of whether the node is stale or active. So deleting a cluster node through the CLI/JMAP API isn’t currently supported.

Based on the current server code, ClusterNode objects are intentionally treated as read-only/telemetry-like objects: the JMAP set handler for ClusterNode (along with Log, Metric, and Trace) unconditionally rejects create, update, and destroy operations with “Telemetry objects cannot be deleted” (and similar messages for create/update). This is why your delete ClusterNode call fails with “forbidden” even though the ClusterNode reference doc shows a destroy example, the actual server currently blocks it regardless of the id you pass.

So this isn’t something you’re doing wrong. Stale cluster node entries currently cannot be removed via the API/CLI as documented; the destroy path is disabled in the code for this object type. There is no workaround visible in the docs or config for pruning stale nodes manually right now.

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