Value provided in ExpressionAttributeValues unused in expressions
TL;DR — You supplied a value placeholder in ExpressionAttributeValues (e.g. :status) that no expression references. DynamoDB requires every declared :value to be used in a KeyConditionExpression, FilterExpression, UpdateExpression, or ConditionExpression. Remove the orphan value — or fix the expression that was meant to use it.
What it means
ValidationException: Value provided in ExpressionAttributeValues unused in
expressions: keys: {:status}ExpressionAttributeValues is the substitution map for the literal values your expressions compare against (:status, :min, …). DynamoDB enforces a two-way contract: every :placeholder used in an expression must be declared, and every declared placeholder must be used. A leftover value that no expression references triggers this HTTP 400 ValidationException — client-side and not retryable until the maps match.
Why it happens
- A stale value after editing the expression — you dropped
#s = :statusfrom the expression but left:statusin the values map. - Copy-paste drift — reusing a values map from a previous request that had more conditions than the current one.
- A generated request that over-declares — a builder added
:vfor a filter clause that was later removed. - A name-vs-value mix-up — you meant
#status(a name alias) but declared:status(a value). - A typo — the expression uses
:statwhile the map declares:status.
How to fix it
- Delete the unused value the message names from
ExpressionAttributeValues. - Keep values in lock-step with the expression — declare a
:placeholderonly when an expression references it. - Confirm names vs values —
:placeholders go inExpressionAttributeValues;#aliases go inExpressionAttributeNames. - Build the expression and its maps together so no value is left dangling.
Related errors
- Value provided in ExpressionAttributeNames unused in expressions — the same rule for
#namealiases. - ExpressionAttributeValues contains invalid value — a malformed or empty value in the map.
- An expression attribute value used in expression is not defined — the reverse: a placeholder referenced but not supplied.