Error: DynamoDB attribute not empty

Answered by Rafal Wilinski
Last updated: October 23rd, 2026
Solution
An attribute being empty is not universally invalid in DynamoDB. Empty non-key strings and binary values, empty lists, and empty maps are allowed. Empty sets and empty table or index key values are not. Identify the attribute’s role and type before changing it.
To require a nonempty string in a condition or filter, combine existence, type, and size checks:
const params = {
TableName: "Orders",
Key: { id: "123" },
UpdateExpression: "SET #status = :ready",
ConditionExpression: "attribute_exists(#note) AND attribute_type(#note, :stringType) AND size(#note) > :zero",
ExpressionAttributeNames: { "#note": "note", "#status": "status" },
ExpressionAttributeValues: { ":stringType": "S", ":zero": 0, ":ready": "READY" }
};
// Pass params to SDK v3 UpdateCommand with DynamoDBDocumentClient.The condition examines the current item, not the value being assigned by the update. An absent field, a NULL field, and an empty string are distinct states. Whitespace-only strings have a nonzero size; normalize them in the application if they should count as empty. Do not introduce fake values solely to satisfy a key or set constraint.
See empty value rules and AWS documentation.
Other Common DynamoDB Errors (with Solutions)
- dynamodb problem function call failed
- dynamodb: one or more parameter values were invalid: type mismatch for index key
- dynamodb the parameter cannot be converted to a numeric value NaN
- dynamodb cannot read properties of undefined
- dynamodb condition does not exist
- dynamodb global secondary index not working
- dynamodb list_append if_not_exists not working
- boto3 dynamodb unable to locate credentials
- dynamodb unknown error
- moto dynamodb not working
- dynamodb could not connect to the endpoint url
- dynamodb converter not found for enhancedtype
- DynamoDB FilterExpression Not Working
- DynamoDB Update Not Working
- dynamodb unable to locate property for key attribute
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
- SSH GUI Client
- Chat With Cloud
- MongoDB GUI Client
- AWS Cost Monitoring
- DynamoDB Query Builder
- DynamoDB Code Examples
- DynamoDB Node.js Queries
- DynamoDB JSON Converter
- DynamoDB UUID Generator
- DynamoDB Local Admin GUI
- DynamoDB Pricing Calculator
- DynamoDB Single-Table Design
- Best DynamoDB GUI Clients
- Dynobase vs DynoTable