DynamoDB — The expression can not be empty

TL;DR — You passed an expression parameter (FilterExpression, KeyConditionExpression, ProjectionExpression, UpdateExpression, or ConditionExpression) as an empty string "". DynamoDB requires expression parameters to be either a valid non-empty expression or absent entirely — an empty string is invalid. Only include the parameter when you actually have an expression; otherwise omit the key.

What it means

ValidationException: Invalid FilterExpression: The expression can not be empty;
ValidationException: Invalid KeyConditionExpression: The expression can not be empty;

DynamoDB treats an empty string differently from an omitted parameter. Omitting FilterExpression means "no filter"; passing FilterExpression: "" means "here is a filter" — and then there's nothing to parse, so validation fails. The same applies to every expression parameter.

Why it happens

  • Conditionally-built params always set — code always attaches FilterExpression to the request object, then leaves it "" when no filter was chosen.
  • A helper/ORM/connector that emits an empty expression string instead of dropping the key when the filter list is empty.
  • String concatenation that produced nothing — joining an empty array of conditions yields "".
  • Trimmed-away content — placeholders were stripped, leaving an empty expression.

How to fix it

  1. Only set the parameter when it's non-empty. Build the params object conditionally: if (filter) params.FilterExpression = filter; — never assign "".
  2. Delete empty keys before the call — strip any expression property whose value is an empty/whitespace string from the request.
  3. Guard your builder — if the list of conditions is empty, don't attach the expression at all.
  4. Remember they're independentExpressionAttributeNames/Values should also be omitted (not {} referenced by nothing) when there's no expression using them.
  5. For a full-table read, a Scan with no FilterExpression is correct — omit the parameter rather than passing an empty one.

Run it in DynoTable

DynoTable only sends expression parameters you actually configure — an empty filter list omits FilterExpression entirely instead of passing "". Open a table with ⌘K, add filters in the query panel, and copy the generated request when at least one condition is present.

Use the Query Builder to prototype reads before wiring conditional params in code. Staging (⌘S) catches empty-expression mistakes on updates. Switch profiles with ⌘P; Test Connection on Settings → Profiles confirms the target table. See Connect to AWS and Install. An omitted parameter and an empty string are different — only the latter triggers this error.

Sources

References

Last verified 2026-07-13 against the official AWS documentation linked above.

Work with DynamoDB without the Console

A fast DynamoDB desktop client that runs the real SQL DynamoDB can’t — JOINs, GROUP BY, aggregates — with visual editing and an AI agent on your own Bedrock keys.

Free 30-day trial, no credit card — then the Free plan with no time limit.