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 aliasing is not supported
- dynamodb mapper save not persisting
- DynamoDB Delete Not Working
- name key is not defined dynamodb
- DynamoDB Errors InvalidSignatureException Signature Expired
- ConfigError: Missing region in config
- DynamoDB Update Not Working
- failed to list tables not authorized dynamodb
- dynamodb cannot assign requested address
- DynamoDB Invalid UpdateExpression Syntax Error Token
- DynamoDB Query Limit Not Working
- dynamodb cannot read property 's' of undefined
- dynamodb botocore.exceptions.nocredentialserror unable to locate credentials
- dynamodb query key condition not supported
- DynamoDB Is Unsupported It Cannot Be Instantiated
Tired of switching accounts and regions? Use Dynobase.
Try 7-day free trial. No strings attached.
Product Features
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase