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 validation error detected
- DynamoDB Key element does not match the schema
- DynamoDB Internal Server Error
- requested resource not found aws dynamodb
- dynamodb-admin command not found
- aws.dynamodb.converter.unmarshall not working
- dynamodb put item not working
- sls dynamodb install not working
- DynamoDB ValidationException: Query condition missed key schema element
- ImportError: No module named boto3 (DynamoDB)
- could not unmarshal the value dynamodb
- DynamoDB ConditionalCheckFailedException
- DynamoDB Invalid UpdateExpression Syntax Error Token
- why is the GSI dynamodb not showing item count
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase