Value provided in ExpressionAttributeNames unused in expressions

TL;DR — You declared a name placeholder in ExpressionAttributeNames (e.g. #status) that no expression references. DynamoDB requires every declared alias to be used in a KeyConditionExpression, FilterExpression, UpdateExpression, ConditionExpression, or ProjectionExpression. Remove the unused alias — or fix the expression that was supposed to reference it.

What it means

ValidationException: Value provided in ExpressionAttributeNames unused in
expressions: keys: {#status}

ExpressionAttributeNames is a substitution map for attribute-name aliases (needed for reserved words or names with special characters). DynamoDB enforces a strict two-way contract: every alias you use in an expression must be declared, and every alias you declare must be used. A leftover, unreferenced entry triggers this HTTP 400 ValidationException. It's client-side and not retryable until the map matches the expressions.

Why it happens

  • A stale alias left after editing an expression — you removed #status = :s from the expression but forgot to delete #status from the names map.
  • A generated map that over-declares — a mapping layer emitted aliases for every attribute even ones the final expression doesn't touch.
  • The alias is in the values map, not names — you meant :status (a value) but declared #status (a name).
  • A typo mismatch — the expression uses #stat while the map declares #status, so #status is technically unused.

How to fix it

  1. Delete the unused alias the message names from ExpressionAttributeNames.
  2. Keep the map in lock-step with the expressions — declare a #name only when an expression actually references it.
  3. Check for a name-vs-value mix-up#-aliases live in ExpressionAttributeNames, :-placeholders in ExpressionAttributeValues.
  4. Regenerate the request so names, values, and expression text are built together rather than assembled by hand.

不必透過主控台就能操作 DynamoDB

DynoTable 是一款快速的 DynamoDB 桌面用戶端 — 瀏覽表格、執行 SQL 風格的查詢,並在本機編輯項目。