| code | 40031 |
|---|---|
| identifier | invalid_client_specified_message_id |
| title | Invalid client-specified message id |
| summary | A publish was rejected because a client-supplied message id was missing, empty, or not in the required format. When several messages are published together, every message must carry a valid id following the expected pattern. |
When you assign your own message ids and publish several messages atomically, give every message an id derived from one base id, in the form <base id>:<index> (foo:0, foo:1, foo:2, and so on). If you need each message to be independently idempotent, publish them separately or use the batch publish API instead.
A client-specified message id acts as an idempotency key. For messages published atomically in one call, Ably requires all ids to share a single base id with a positional suffix, so the idempotency scope of the group is unambiguous. An id that is missing, empty, not a string, or that doesn't follow the <base id>:<index> pattern is rejected.
The error is reported with code 40031 and HTTP status 400. The messages include Client-specified message id cannot be empty and Client-specified message ids do not match the required format for multi-message ProtocolMessages.