Error: an expression attribute name used in the document path is not defined

Answered by Rafal Wilinski
Last updated: October 23rd, 2026
Solution
This error means an expression contains a #name alias that is absent from ExpressionAttributeNames. The map must cover aliases in every expression in the request, not just the key condition.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, QueryCommand } from "@aws-sdk/lib-dynamodb";
const db = DynamoDBDocumentClient.from(new DynamoDBClient({}));
const result = await db.send(new QueryCommand({
TableName: "Users",
KeyConditionExpression: "#id = :id",
ProjectionExpression: "#profile.#name",
ExpressionAttributeNames: {
"#id": "id", "#profile": "profile", "#name": "name",
},
ExpressionAttributeValues: { ":id": "user-1" },
}));The nested path #profile.#name needs two aliases. Mapping a single alias to profile.name refers to an attribute literally named profile.name instead. Check capitalization, accidental map overwrites when composing request objects, and the distinction between #name aliases and :value placeholders. Remove alias definitions that no expression uses.
See expression aliases and AWS documentation.
Other Common DynamoDB Errors (with Solutions)
- DynamoDB scan filter expression not working
- DynamoDB Failed To Compute Node presentation
- dynamodb does not accept empty set
- DynamoDB sorting is not supported for scan expressions
- dynamodb ttl not deleting / erasing items
- could not unconvert attribute dynamodb
- DynamoDB no attribute schema defined
- DynamoDB string set cannot be empty
- ImportError: No module named boto3 (DynamoDB)
- dynamodb unknown error
- DynamoDB TTL Not Working
- ExpressionAttributeValues contains invalid value: One or more parameter values were invalid: An AttributeValue may not contain an empty string
- dynamodb unable to locate credentials
- DynamoDB type is not supported
- DynamoDB aliasing is not supported
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase