# Enforce idempotency and prevent concurrent Ontology Actions from overwriting each other

**URL:** <https://community.palantir.com/t/enforce-idempotency-and-prevent-concurrent-ontology-actions-from-overwriting-each-other/7249>\
**Category:** Ask the Community\
**Tags:** ontology-management, functions\
**Created:** [September 20, 2026, 10:48pm UTC](https://community.palantir.com/t/enforce-idempotency-and-prevent-concurrent-ontology-actions-from-overwriting-each-other/7249 "2026-09-20T22:48:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anawaz](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@anawaz](https://community.palantir.com/u/anawaz)\
**Post date:** [September 20, 2026, 10:48pm UTC](https://community.palantir.com/t/enforce-idempotency-and-prevent-concurrent-ontology-actions-from-overwriting-each-other/7249/1 "2026-09-20T22:48:50Z")

</div>

Is there a recommended way to enforce idempotency and prevent concurrent Ontology Actions from overwriting each other when both read the same initial object state?

I need a non-primary-key property on `Object B` to be unique, but the Ontology doesn’t enforce that (from what I see). rn I am considering adding `objectBId` to related `Object A`, then using a TypeScript V2 function to create `Object B` and set `ObjectA.objectBId` in the same Action (to enforce a 1:1).

What I am wondering is, if two Actions concurrently see `ObjectA.objectBId` as empty, one tries to create `B1` and the other `B2`. Will OSv2 guarantee that only one Action succeeds and fully roll back the loser, or could both B1 and B2 be created while Object A ends up pointing to whichever update was written last?

In other word, what I am worried about with this solution of solving a race case:

```bash
Action A: set ObjectA.objectBId = B1
Action B: set ObjectA.objectBId = B2

```

But what I want to happen is

```bash
Action A: set ObjectA.objectBId = B1
Action B: tries to set ObjectA.objectBId = B2 -> but here it fails, or see theres a version conflict that I can catch, which then kicks off some remediation work

```
