Transaction request cannot include multiple operations on one item
TL;DR — Two actions in the same TransactWriteItems request target the same item (same primary key). DynamoDB requires every item in a transaction to be unique, so it rejects the whole call before running any of it. Collapse the duplicate actions into one, or move one of them to a separate write.
What it means
ValidationException: Transaction request cannot include multiple operations on one itemA TransactWriteItems request groups up to 100 actions (Put, Update, Delete, ConditionCheck) that all commit or all fail. A hard rule of that API is that no two actions can target the same item — DynamoDB identifies an item by its full primary key, and each key may appear at most once. This is an HTTP 400 ValidationException, caught before the transaction executes, and it is not retryable as-is.
Why it happens
- A
ConditionCheckplus a write on the same key — you tried to assert a condition on an item and alsoUpdate/Deleteit in the same transaction. Fold the condition into the write'sConditionExpressioninstead. - Two writes to the same key — e.g. a
Putand anUpdatefor the same item, often from a loop that doesn't de-duplicate by key. - A generated batch with duplicate keys — an ORM or mapping layer emitted the same partition+sort key twice.
- Same key in two different actions across tables you think are different — the item is uniquely
{table, PK, SK}; a repeat within the same table triggers it.
How to fix it
- De-duplicate by primary key before building the transaction — each
{PK, SK}may appear once. - Merge a
ConditionCheckinto the write it guards: put the assertion in that item's ownConditionExpressionrather than adding a separateConditionCheckaction. - Combine two mutations into one
Updateusing a singleUpdateExpression(SET/ADD/REMOVE) instead of two actions. - Split unavoidable multi-step logic across separate transactions or writes if the operations genuinely can't be expressed as one action.
- Log the primary keys in your
TransactItemsarray. Duplicate keys are easy to miss in generated batches — print each{PK, SK}before send.
Check first in DynoTable
Before building a multi-item transaction, list target keys in DynoTable — open the table with ⌘K and confirm each primary key is unique in your action list. Staging (⌘S) lets you test a single-item transaction before you scale up.
Merge condition checks into writes using the Expression Builder. Switch profiles with ⌘P; see Connect to AWS and Install.
Sources
- TransactWriteItems — Amazon DynamoDB API Reference (verified 2026-07-13)
- Amazon DynamoDB Transactions: How it works (verified 2026-07-13)
Related errors
- TransactionCanceledException — the transaction parsed but a condition or conflict cancelled it at commit.
- Too many items in a TransactWriteItems call — more than 100 actions in one transaction.
- ValidationException (overview)
- Code example: TransactWriteItems in Node.js — a valid multi-item transaction to adapt.
- Learn: DynamoDB transactions
References
- TransactWriteItems — Amazon DynamoDB API Reference
- Amazon DynamoDB Transactions: How it works — Amazon DynamoDB Developer Guide
- Error handling with DynamoDB — Amazon DynamoDB Developer Guide
Last verified 2026-07-13 against the official AWS documentation linked above.