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)
- AWS DynamoDB CredentialsError: Missing credentials in config
- ConfigError: Missing region in config
- dynamodb the parameter cannot be converted to a numeric value
- a bytes-like object is required not binary dynamodb
- error retrieving dynamodb table item serializationexception
- dynamodb put item not working
- dynamodb list_append if_not_exists not working
- dynamodb list_append returns true but does not work
- can't pickle thread.lock objects typeerror boto3 python dynamodb
- ValidationException: Invalid KeyConditionExpression: Attribute name is a reserved keyword;
- Could not connect to the endpoint URL https:dynamodb.singapore.amazonaws.com
- dynamodb ttl not deleting / erasing items
- DynamoDB could not invoke null on class
- DynamoDB Internal Server Error
- AWS Lambda DynamoDB Stream Error
Dynobase is a Professional GUI Client for DynamoDB
First 7 days are. No credit card needed.
Product Features
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase