40901: Message sequence mismatch
message_sequence_mismatchAn update, delete, append or patch was rejected because the sequence number it carried was not exactly one more than the message's current sequence number.
What you should do
Read the message's current sequence number from the error's detail, under sequence. Then publish the change again with that sequence number plus one.
If the current sequence number is at or above the one you sent, your change may already have been applied. Read the latest version of the message before you send it again.
If a series of appends failed part way through, the message is missing everything from the first failed append onwards. Publish an update with the full content instead, using the current sequence number plus one.
If another client also changes the same message, your record of its sequence number no longer holds. Agree on who changes the message, or read its latest version before you change it.
Why it happens
An update, delete, append or patch can carry a sequence number in version.sequence. A message starts at sequence number 0 when it is created, and each change that carries a sequence number must be exactly one more than the current one. Changes are often sent without waiting for earlier ones to complete. When an earlier change fails, the next one arrives with a sequence number that is too high, and it is rejected so that the message never includes a later change without the earlier one. A change that arrives with a sequence number that is too low, is acknowledged as a retry and is not applied again.
A change that carries no sequence number is not checked, and does not change the message's sequence number.
What you'll see
The change is rejected and not applied. The error is reported with code 40901 and HTTP status 409. The message's current sequence number is in the error's detail under sequence.