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.
Composing multi-item transactions by hand is where duplicate keys slip in. The DynoTable desktop app shows each item by its primary key so a repeated target is obvious before you send the request.
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)