dynobase-icon
Dynobase

Error: Conditional Update Error DynamoDB

Rafal Wilinski

Answered by Rafal Wilinski

Last updated: October 23rd, 2026

Solution

A conditional update fails with ConditionalCheckFailedException when its condition evaluates to false. DynamoDB leaves the item unchanged. This can be the intended protection against stale writes or updates to a missing item.

import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, UpdateCommand } from "@aws-sdk/lib-dynamodb";

const db = DynamoDBDocumentClient.from(new DynamoDBClient({}));

await db.send(new UpdateCommand({
  TableName: "Orders",
  Key: { pk: "CUSTOMER#123", sk: "ORDER#42" },
  UpdateExpression: "SET #status = :next",
  ConditionExpression: "#status = :expected",
  ExpressionAttributeNames: { "#status": "status" },
  ExpressionAttributeValues: { ":next": "SHIPPED", ":expected": "PAID" },
  ReturnValuesOnConditionCheckFailure: "ALL_OLD",
}));

Check the complete key, attribute type and current value. Missing attributes, String versus Number differences, or another writer changing the state can explain the failure. Where supported, ALL_OLD makes the failure item available in the exception; otherwise read it and remember it can change again.

Retry only after deciding the update is still valid. A version conflict usually requires reading fresh state and recomputing the change. Removing the condition merely to make the write succeed defeats the concurrency protection.

See conditional writes and AWS documentation.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase
+
Still using AWS DynamoDB Console?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.