Error: DynamoDB string set cannot be empty

Answered by Rafal Wilinski
Last updated: October 23rd, 2026
Solution
A DynamoDB String Set must contain at least one member. An empty set is invalid, even though empty non-key String values are allowed. Decide whether an empty collection should mean an absent attribute, NULL, or a List, and encode that choice explicitly.
import boto3
table = boto3.resource("dynamodb", region_name="us-east-1").Table("Orders")
tags = set()
item = {"id": "123"}
if tags:
item["tags"] = tags
table.put_item(Item=item)This PutItem example replaces the item at that key. To clear tags on an existing item without replacing other fields, use an UpdateItem REMOVE expression. Use an empty list only if list semantics suit the application; lists and sets have different ordering and duplicate behavior.
Do not add a fake member just to pass validation. Boto3’s put_item and update_item methods do not automatically turn an empty set into a valid collection. Validate nested sets as well as top-level ones.
See sets and lists and AWS documentation.
Other Common DynamoDB Errors (with Solutions)
- DynamoDB BatchSave not working
- DynamoDB ConditionalCheckFailedException
- dynamodb getItem() is not a function
- AWS DynamoDB CredentialsError: Missing credentials in config
- dynamodb problem function call failed
- dynamodb does not support null values
- dynamodb stream missing fields
- could not connect to the endpoint URL dynamodb
- dynamodb cannot read properties of undefined
- dynamodb query key condition not supported
- Unable to start DynamoDB Local process
- Conditional Update Error DynamoDB
- DynamoDB Expression Not Null
- DynamoDB string set may not be empty
- error updating dynamodb table time to live
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today