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 from buildSelect when a key in a FindOptionsSelect map is neither an embedded, a column, nor a relation on the entity metadata. The strict lookup `findColumnWithPropertyPathStrict` refuses to silently ignore unknown fields, turning typos into hard failures.

Source

Thrown at packages/@n8n/typeorm/src/query-builder/SelectQueryBuilder.ts:3267

		);
	}

	protected buildSelect(
		select: FindOptionsSelect<any>,
		metadata: EntityMetadata,
		alias: string,
		embedPrefix?: string,
	) {
		for (let key in select) {
			if (select[key] === undefined || select[key] === false) continue;

			const propertyPath = embedPrefix ? embedPrefix + '.' + key : key;
			const column = metadata.findColumnWithPropertyPathStrict(propertyPath);
			const embed = metadata.findEmbeddedWithPropertyPath(propertyPath);
			const relation = metadata.findRelationWithPropertyPath(propertyPath);

			if (!embed && !column && !relation)
				throw new EntityPropertyNotFoundError(propertyPath, metadata);

			if (column) {
				this.selects.push(alias + '.' + propertyPath);
				// this.addSelect(alias + "." + propertyPath);
			} else if (embed) {
				this.buildSelect(select[key] as FindOptionsSelect<any>, metadata, alias, propertyPath);

				// } else if (relation) {
				//     const joinAlias = alias + "_" + relation.propertyName;
				//     const existJoin = this.joins.find(join => join.alias === joinAlias);
				//     if (!existJoin) {
				//         this.joins.push({
				//             type: "left",
				//             select: false,
				//             alias: joinAlias,
				//             parentAlias: alias,
				//             relationMetadata: relation
				//         });

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Align the select map with current entity metadata; remove or rename the offending key.
  2. Derive select keys from the entity's column names (e.g. Object.keys(metadata.columns)) rather than hand-maintaining them.
  3. After a migration, search for the renamed column in all select/where/order maps.

Example fix

// before
repo.find({ select: { firstName: true, surName: true } }); // column is lastName
// after
repo.find({ select: { firstName: true, lastName: true } });
Defensive patterns

Strategy: validation

Validate before calling

function sanitizeSelect<T>(meta: EntityMetadata, select: Record<string, boolean>): FindOptionsSelect<T> {
  const out: Record<string, boolean> = {};
  for (const [k, v] of Object.entries(select)) {
    const isCol = !!meta.findColumnWithPropertyPathStrict(k);
    const isEmbed = !!meta.findEmbeddedWithPropertyPath(k);
    const isRel = !!meta.findRelationWithPropertyPath(k);
    if (isCol || isEmbed || isRel) out[k] = v;
    else throw new Error(`select key '${k}' is not a column/embed/relation`);
  }
  return out as FindOptionsSelect<T>;
}

Type guard

function isKnownProperty(meta: EntityMetadata, key: string): boolean {
  return !!meta.findColumnWithPropertyPathStrict(key)
      || !!meta.findEmbeddedWithPropertyPath(key)
      || !!meta.findRelationWithPropertyPath(key);
}

Try / catch

try {
  return await repo.find({ select });
} catch (e) {
  if (e?.name === 'EntityPropertyNotFoundError') throw new BadRequestException(e.message);
  throw e;
}

Prevention

When it happens

Trigger: Calling `repo.find({ select: { misSpelled: true } })`, passing a select map built from stale type definitions after a column rename, or generating select keys dynamically from user input that includes a non-column name.

Common situations: Schema migration renaming/dropping a column while the select map still references the old name; copy-paste of select maps across entities; DTO-to-select mappers that include keys which are relations/computed fields not mapped as columns.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/cd0ffd1370ab1280. Report an issue: GitHub.