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

Answered by Rafal Wilinski
What's Causing This Error
This error occurs when you have used expression attribute names for the KeyConditionExpression
or FilterExpression
that are not defined in the ExpressionAttributeNames
parameter.
Solution - Here's How To Resolve It
To resolve the error, define all the expression attribute names you've specified for the document paths in the ExpressionAttributeNames
object.
This is shown below.
const doFunStuff = async () => { await documentClient.query({ TableName: 'test-table', KeyConditionExpression: '#id = :id', ProjectionExpression: '#name', // define all the expression attribute names used in the query ExpressionAttributeNames: { '#id': 'id', '#name': 'name' }, ExpressionAttributeValues: { ':id': '1' }, }).promise(); }; doFunStuff();
Other Common DynamoDB Errors (with Solutions)
- dynamodb value cannot be null. (parameter 'type')
- dynamodb exclusivestartkey not working
- dynamodb unable to execute http request
- dynamodb the parameter cannot be converted to a numeric value
- dynamodb table not exists
- localstack dynamodb not working
- dynamodb could not be mapped for type string
- dynamodb no range key value present
- DynamoDB stream not working
- dynamodb stream missing fields
- dynamodb-admin command not found
- DynamoDB Code Working In Node But Not SAM
- DynamoDB attribute not empty
- aws.dynamodb.converter.unmarshall not working
- Unable to start DynamoDB Local process
Tired of AWS Console? Try Dynobase.
First 7 days are on us. No strings attached.
Product Features
DynamoDB Tools
DynamoDB Info
© 2025 Dynobase