clayered_modify_stable() and clayered_modify_ingest() are multi-step operations. When necessary, they decode the value, apply the modification, re-encode the result, and write it back with a full update.
If an error occurs after the modify and before the full update completes, the intermediate unescaped update remains in the transaction’s update chain. Subsequent operations in the same transaction can observe that value.
The transaction is marked rollback-required and cannot be committed, so the intermediate value cannot be persisted by commit or checkpoint. However, the failed transaction can continue performing operations, observe the raw unescaped value, or apply additional writes before it is rolled back.
Investigate making the layered modify operation atomic with respect to encoding and the final update, or otherwise prevent subsequent operations from observing the intermediate value.