# Resolve actual IDs from temporary IDs in case of communication failures during transaction executing

**URL:** <https://forum.datomic.com/t/resolve-actual-ids-from-temporary-ids-in-case-of-communication-failures-during-transaction-executing/2495>\
**Category:** Datomic Pro\
**Created:** [November 25, 2024, 4:49pm UTC](https://forum.datomic.com/t/resolve-actual-ids-from-temporary-ids-in-case-of-communication-failures-during-transaction-executing/2495 "2024-11-25T16:49:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolayandr](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/nikolayandr/32/375_2.png) [@nikolayandr](https://forum.datomic.com/u/nikolayandr)\
**Post date:** [November 25, 2024, 4:49pm UTC](https://forum.datomic.com/t/resolve-actual-ids-from-temporary-ids-in-case-of-communication-failures-during-transaction-executing/2495/1 "2024-11-25T16:49:50Z")

</div>

Hello, Datomic community,

The documentation ([Datomic Deployment | Datomic](https://docs.datomic.com/operation/deployment.html#peer-failover)) mentions that “Not all transactions are idempotent, and transactions may have succeeded, even if the communication back to the peer failed.” This raises the question: How to resolve actual IDs from temporary IDs if a communication error occurs but the transaction may have been successful on the transactor side?

In my case, I need to obtain the entity identifiers created during a transaction. Under normal circumstances, I would use temporary identifiers ([Transaction Data | Datomic](https://docs.datomic.com/transactions/transaction-data-reference.html#tempids)) to later resolve them to their actual entity IDs using `resolve-tempid` ([datomic.api - Datomic Clojure API documentation](https://docs.datomic.com/clojure/index.html#datomic.api/resolve-tempid)).

However, if a communication error occurs but the transaction has succeeded, I would need to repeat the transaction on the version of the database that was current just before the transaction was executed. The issue is that the `as-of` functionality cannot be used for branching ([Database Filters | Datomic](https://docs.datomic.com/reference/filters.html#as-of-not-branch)), which prevents me from repeating the creation of the entity since calling `with` + `as-of` leads to an error such as:

```auto
:db.error/unique-conflict Unique conflict: :myUniqueAttribute, value: 2 already held by: 17592186045515 asserted for: 17592186045517

```

How can I approach implementing retries while ensuring that I can still get the correct entity identifiers in case of such errors?

Thank you

---

<div class="post-metadata">

**Author:** ![maxweber](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@maxweber](https://forum.datomic.com/u/maxweber)\
**Post date:** [December 11, 2024, 9:52pm UTC](https://forum.datomic.com/t/resolve-actual-ids-from-temporary-ids-in-case-of-communication-failures-during-transaction-executing/2495/2 "2024-12-11T21:52:53Z")

</div>

I guess the only option is to work with a `:db.unique/identity` attribute for your external identifier. Then you can just retry the transaction and it will do an upsert of the entity with the given identifier if it already exists.
