n8n-io/n8n · error · EntityPropertyNotFoundError
Property "${propertyPath}" was not found in "${metadata.targ
Error message
Property "${propertyPath}" was not found in "${metadata.targetName}". Make sure your query is correct. What it means
Thrown as EntityPropertyNotFoundError when QueryBuilder.normalizePropertyPath resolves an alias but the resolved aliasPropertyPath (the dot-joined remaining parts) does not match any column on that alias's entity metadata via findColumnsWithPropertyPath. It signals a WHERE/ORDER BY/SET clause referenced a property path that the entity does not expose.
Source
Thrown at packages/@n8n/typeorm/src/query-builder/QueryBuilder.ts:1167
root.push(...part.split('.'));
propertyPathParts.shift();
continue;
}
break;
}
if (!alias) {
throw new Error(`Cannot find alias for property ${propertyPath}`);
}
// Remaining parts are combined back and used to find the actual property path
const aliasPropertyPath = propertyPathParts.join('.');
const columns = alias.metadata.findColumnsWithPropertyPath(aliasPropertyPath);
if (!columns.length) {
throw new EntityPropertyNotFoundError(propertyPath, alias.metadata);
}
return [alias, root, columns];
}
/**
* Creates a property paths for a given ObjectLiteral.
*/
protected createPropertyPath(
metadata: EntityMetadata,
entity: ObjectLiteral,
prefix: string = '',
) {
const paths: string[] = [];
for (const key of Object.keys(entity)) {
const path = prefix ? `${prefix}.${key}` : key;
View on GitHub (pinned to 5ac6606e81)
Solutions
- Print metadata.targetName and inspect the actual @Column/@RelationPropertyPath fields of that entity; correct the property string in the query.
- If the path is dynamic/user-supplied, validate it against Object.keys(metadata.propertiesMap) before passing it to the builder.
- For raw expressions that are not entity properties, wrap them in a literal/bracketed SQL form or use addGroupBy/raw select instead of a property-path API.
- Run pnpm typecheck and rebuild the @n8n/db package after entity renames so stale references surface at compile time.
Example fix
// before
qb.where('user.fullName = :v', { v: name });
// after (fullName is not a column; use firstName + lastName)
qb.where('user.firstName = :first', { first: f })
.andWhere('user.lastName = :last', { last: l }); Defensive patterns
Strategy: validation
Validate before calling
import { DataSource } from 'typeorm';
function assertPropertyPath(ds: DataSource, target: Function, path: string) {
const meta = ds.getMetadata(target);
const parts = path.split('.');
let props = meta.propertiesMap;
for (const p of parts) {
if (!(props as Record<string, unknown>)[p])
throw new Error(`Unknown property path '${path}' on ${meta.targetName}`);
}
}
// assertPropertyPath(ds, User, 'user.fullName') before qb.where(...) Type guard
function isValidPropertyPath(value: unknown): value is string {
return typeof value === 'string' && /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/.test(value);
} Prevention
- Never hand-build property-path strings from user input; whitelist allowed paths per entity.
- After renaming an entity column, run a repo-wide search for the old name in string literals.
- Keep query fragments typed: import alias names and column names as constants from the entity module.
When it happens
Trigger: Calling qb.where('user.nonExistentField = :val', {val:1}) or qb.orderBy('user.tpyo') where the path is misspelled or refers to a column that was removed/renamed in the entity. Also triggered by referencing embedded/relation paths with wrong separators, or by passing a raw SQL fragment that TypeORM tries to interpret as a property path of the main alias.
Common situations: Entity refactor renames a column but query strings keep the old name; copy-pasted query from another entity; accessing a getter that is not a @Column; using camelCase path when the entity uses snake_case propertyPath after a naming-strategy change; leftover references after a migration drops a column.
Related errors
- Cannot find alias for relation at ${fullRelationPath}
- Cannot find alias for property ${propertyPath}
- Cannot query across ${relation.relationType} for property ${
- "${aliasName}" alias was not found. Maybe you forgot to join
- Entity to work with is not specified!
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/ef98991bf30ef5f4.
Report an issue: GitHub.