Expression size has exceeded the maximum allowed size
TL;DR — DynamoDB limits any single expression string to 4 KB (the expression parameters: UpdateExpression, ConditionExpression, FilterExpression, ProjectionExpression). Yours grew past it — usually an auto-generated update over a big item, or a giant IN (…) / OR filter. Shrink the expression, not the item.
What it means
ValidationException: 1 validation error detected: Invalid ConditionExpression: Expression size has exceeded the maximum allowed size; expression size: 27785The trailing byte count is your expression's measured size, so it differs on every request.
The 4 KB cap is on the length of the expression string itself, independent of the item's 400 KB size. A well-under-400 KB item can still overflow the expression budget if the SDK builds one clause per attribute (verbose placeholder names add up fast). It's an HTTP 400 ValidationException — not retryable without changing the expression.
The expression budget has siblings you can hit first: each #name/:value placeholder is capped at 255 bytes, the combined ExpressionAttributeNames + ExpressionAttributeValues at 2 MB, a single expression at 300 operators/functions, and an IN comparator at 100 operands.
Why it happens
- Auto-generated
UpdateExpressionover a wide item — an ORM/mapper emitsSET #a0 = :v0, #a1 = :v1, …for every attribute, and the placeholder names + separators cross 4 KB. - A huge
FilterExpression— a longattr IN (:0, :1, …)or a chain ofORed conditions. - Bulk conditional writes with many
attribute_not_exists/comparisons in oneConditionExpression. - Console edits of large items — saving a big item re-emits a large update/condition expression.
How to fix it
- Only update what changed. Build the
UpdateExpressionfrom the diff, not the whole item — most updates touch a handful of attributes. - Shorten placeholder names.
#a/:vbeat long descriptive names; the length that counts is the expression string, so terser names buy real headroom. - Split a giant filter into narrower queries, or restructure so the filter isn't needed (a better key/index means fewer
ORed conditions). - Break one oversized write into several smaller updates, or model the item so a single logical change doesn't rewrite everything.
- Reduce nesting — deeply nested map paths inflate expression length; flatten where you can.
- Cap
INlists at 100 operands. That is a separate documented limit that can fail before the 4 KB string cap.
From DynoTable
DynoTable builds update expressions from the fields you actually change — not every attribute on the item — keeping expressions well under 4 KB. Open an item with ⌘K, edit specific fields, and copy the generated expression string length.
Use the Expression Builder to watch expression size as you add clauses. The item size calculator helps when wide items drive auto-generated updates. Switch profiles with ⌘P; see Connect to AWS and Install.
Sources
- Constraints in Amazon DynamoDB (verified 2026-07-13)
- Using update expressions in DynamoDB (verified 2026-07-13)
Related errors
- Item size exceeded the maximum (400 KB) — the item, not the expression, is too big.
- Reserved keyword in attribute name — why you needed placeholders in the first place.
- Learn: Update expressions · Filtering strategies
References
- Constraints in Amazon DynamoDB — Amazon DynamoDB Developer Guide
- Using update expressions in DynamoDB — Amazon DynamoDB Developer Guide
- Error handling with DynamoDB — Amazon DynamoDB Developer Guide
Last verified 2026-07-13 against the official AWS documentation linked above.