dynobase-icon
Dynobase

Error: DynamoDB string set cannot be empty

Rafal Wilinski

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.

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.