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 by EntityMetadata.mapPropertyPathsToColumns when a property path supplied in a query (select, where relations, orderBy, addSelect) cannot be resolved to any column on the entity. The class is EntityPropertyNotFoundError and its constructor receives the offending path and the entity metadata, so the message names both. This runs at query-build time, not at startup.

Source

Thrown at packages/@n8n/typeorm/src/metadata/EntityMetadata.ts:763

	hasEmbeddedWithPropertyPath(propertyPath: string): boolean {
		return this.allEmbeddeds.some((embedded) => embedded.propertyPath === propertyPath);
	}

	/**
	 * Finds embedded with a given property path.
	 */
	findEmbeddedWithPropertyPath(propertyPath: string): EmbeddedMetadata | undefined {
		return this.allEmbeddeds.find((embedded) => embedded.propertyPath === propertyPath);
	}

	/**
	 * Returns an array of databaseNames mapped from provided propertyPaths
	 */
	mapPropertyPathsToColumns(propertyPaths: string[]) {
		return propertyPaths.map((propertyPath) => {
			const column = this.findColumnWithPropertyPath(propertyPath);
			if (column == null) {
				throw new EntityPropertyNotFoundError(propertyPath, this);
			}
			return column;
		});
	}

	/**
	 * Iterates through entity and finds and extracts all values from relations in the entity.
	 * If relation value is an array its being flattened.
	 */
	extractRelationValuesFromEntity(
		entity: ObjectLiteral,
		relations: RelationMetadata[],
	): [RelationMetadata, any, EntityMetadata][] {
		const relationsAndValues: [RelationMetadata, any, EntityMetadata][] = [];
		relations.forEach((relation) => {
			const value = relation.getEntityValue(entity);
			if (Array.isArray(value)) {
				value.forEach((subValue) =>

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Open the entity class and confirm the exact @Column/@Relation property name; TypeORM matches on propertyPath, not databaseName.
  2. Replace the string literal with the actual property name (or use FindOptionsSelect / a typed query builder to get compile-time checking).
  3. For nested/embedded paths, use the correct dotted notation matching propertyPath (e.g. 'profile.address.city').

Example fix

// before
await repo.find({ select: ['user_name'] }); // DB name, wrong

// after
await repo.find({ select: ['userName'] }); // TS property name
Defensive patterns

Strategy: validation

Validate before calling

import type { EntityMetadata } from 'typeorm';

function assertPropertyPaths(
  metadata: EntityMetadata,
  paths: string[],
): void {
  const known = new Set(metadata.columns.map((c) => c.propertyPath));
  for (const p of paths) {
    if (!known.has(p)) {
      throw new Error(`Unknown property path '${p}' on ${metadata.targetName}`);
    }
  }
}

// before querying
assertPropertyPaths(dataSource.getMetadata(User), ['userName', 'email']);

Type guard

import type { FindOptionsSelect } from 'typeorm';
// Using a typed select forces the compiler to reject unknown keys
const select: FindOptionsSelect<User> = { userName: true, email: true };

Try / catch

import { EntityPropertyNotFoundError } from 'typeorm';

try {
  await repo.find({ select: fields });
} catch (err) {
  if (err instanceof EntityPropertyNotFoundError) {
    // log, drop the bad path, and retry with the validated subset
  } else throw err;
}

Prevention

When it happens

Trigger: Calling repo.find({ select: ['nonExistent'] }), createQueryBuilder().orderBy('wrong.path'), or passing a dotted path through a non-embedded relation. Any API that internally calls mapPropertyPathsToColumns with a path that findColumnWithPropertyPath returns null for.

Common situations: Renaming a column but leaving stale string literals in select/where options; using the database column name instead of the TypeScript property name; referencing a relation property without navigating it correctly; refactors that drop a field.

Related errors


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