DynamoDB TransactionConflictException
TL;DR — Another transaction is already operating on the same item as your request, so DynamoDB rejected yours to preserve isolation. It's transient contention, not a bug in your data — retry with exponential backoff, keep transactions small, and cut down concurrent writes to the same hot item.
What it means
TransactionConflictException: Transaction is ongoing for the itemDynamoDB serializes conflicting writes against in-flight transactions. You hit this exception when a plain PutItem, UpdateItem, or DeleteItem collides with an in-flight TransactWriteItems that includes the same item. Rather than block, DynamoDB rejects the single-item write with TransactionConflictException (HTTP 400). It is retryable — the conflict clears once the other transaction commits or aborts.
Note the distinction from TransactionCanceledException: when the losing request is itself a TransactWriteItems or TransactGetItems, DynamoDB cancels that whole transaction instead — you get a cancellation whose CancellationReasons carry TransactionConflict as the per-item reason code, not this exception.
Why it happens
- Concurrent writes to the same item — a plain
PutItem/UpdateItemoverlaps an in-flightTransactWriteItemstouching that item. - Two transactions sharing an item — two
TransactWriteItemsrequests include the same key at the same time; one wins, the other is cancelled with aTransactionConflictreason code (surfaced asTransactionCanceledException). - A hot item under heavy concurrent updates — e.g. a shared counter or a single aggregate row every request updates.
- Long or large transactions holding items long enough to overlap other writers.
- A retry storm — retries without backoff pile more concurrent attempts onto the same contended item.
How to fix it
- Retry with exponential backoff + jitter. This is the primary fix — the conflict is transient and clears when the other transaction settles. Keep jitter so retries don't resynchronize into another collision.
- Keep transactions small and short — fewer items per
TransactWriteItemsmeans shorter holds and less overlap. - Reduce contention on hot items — shard a hot counter across multiple items and aggregate, or use an atomic counter with a plain
UpdateItem(ADD) instead of a transaction when you don't need all-or-nothing semantics. - Don't mix a transaction and a plain write on the same item concurrently if you can avoid it — route both through the same path.
- Monitor the
TransactionConflictCloudWatch metric to see whether contention is rising and where.
Inspect in DynoTable
When the concurrent writer is you, batch manual edits through staging (⌘S) — DynoTable commits them as one reviewed write instead of a stream of overlapping single-item updates. Open contended items with ⌘K and inspect live state before retrying.
Size transactional traffic with the pricing calculator. Switch profiles with ⌘P; Test Connection on Settings → Profiles. See Connect to AWS and Install.
Sources
- Amazon DynamoDB Transactions: How it works (verified 2026-07-13)
- PutItem — Amazon DynamoDB API Reference (verified 2026-07-13)
FAQ
How do I fix TransactionConflictException in DynamoDB? Retry the request with exponential backoff and jitter — the conflict is transient contention with another in-flight transaction on the same item. Also keep transactions small, shard hot items, and avoid running a transaction and a plain write against the same item concurrently.
Is TransactionConflictException the same as TransactionCanceledException? No. TransactionConflictException means another transaction is currently operating on the item. TransactionCanceledException means a whole transaction was rolled back; its CancellationReasons explain why, and a transaction conflict can be one of those reasons.
Related errors
- TransactionCanceledException — a whole transaction rolled back (conditions, capacity, or a conflict).
- ConditionalCheckFailedException — a single write's condition failed.
- Code example: TransactWriteItems in Node.js — a transaction with retry/backoff to adapt.
- Learn: DynamoDB transactions · Atomic counters
References
- Amazon DynamoDB Transactions: How it works — Amazon DynamoDB Developer Guide
- PutItem — Amazon DynamoDB API Reference
- TransactWriteItems — Amazon DynamoDB API Reference
- DynamoDB metrics and dimensions — Amazon DynamoDB Developer Guide
Last verified 2026-07-13 against the official AWS documentation linked above.