dynobase-icon
Dynobase

Error: dynamodb condition does not exist

Rafal Wilinski

Answered by Rafal Wilinski

Last updated: October 23rd, 2026

Solution

To test that an item or attribute does not exist, use attribute_not_exists in a DynamoDB expression. “Condition does not exist” is not a distinct DynamoDB service exception. A valid write condition that evaluates to false produces ConditionalCheckFailedException.

For a create-only put, test the partition-key attribute. DynamoDB evaluates the condition against the item at the full primary key, including the sort key when present:

import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb";
const db = DynamoDBDocumentClient.from(new DynamoDBClient({ region: "us-east-1" }));
await db.send(new PutCommand({
  TableName: "Orders",
  Item: { pk: "ORDER#123", sk: "DETAIL" },
  ConditionExpression: "attribute_not_exists(#pk)",
  ExpressionAttributeNames: { "#pk": "pk" }
}));

To find records missing a non-key attribute, use attribute_not_exists(#field) in a Query or Scan filter instead. An attribute stored as DynamoDB NULL still exists; missing and null are different states. If a write condition fails, inspect the current item and decide whether to reject or recompute the operation. Removing the condition can overwrite data the application intended to protect.

See conditional writes and AWS documentation.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Changelog
/
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.