n8n-io/n8n · error · TypeORMError

Relation with property path ${this.relationPropertyPath} in

Error message

Relation with property path ${this.relationPropertyPath} in entity was not found.

What it means

JoinAttribute.relation getter throws when no relation matching relationPropertyPath is found on the joined entity's metadata, including its parent entity metadata (for joined-table inheritance). The getter walks the selection and its parentEntityMetadata via findRelationWithPropertyPath; if both miss, the relation path does not exist as a @ManyToOne/@OneToMany/@ManyToMany/@OneToOne on that entity.

Source

Thrown at packages/@n8n/typeorm/src/query-builder/JoinAttribute.ts:172

				let relation = relationOwnerSelection.metadata.findRelationWithPropertyPath(
					this.relationPropertyPath!,
				);

				if (relation) {
					return relation;
				}

				if (relationOwnerSelection.metadata.parentEntityMetadata) {
					relation =
						relationOwnerSelection.metadata.parentEntityMetadata.findRelationWithPropertyPath(
							this.relationPropertyPath!,
						);
					if (relation) {
						return relation;
					}
				}

				throw new TypeORMError(
					`Relation with property path ${this.relationPropertyPath} in entity was not found.`,
				);
			};
			this.relationCache = getValue.bind(this)();
			this.relationEvaluated = true;
		}
		return this.relationCache;
	}

	/**
	 * Metadata of the joined entity.
	 * If table without entity was joined, then it will return undefined.
	 */
	get metadata(): EntityMetadata | undefined {
		// entityOrProperty is relation, e.g. "post.category"
		if (this.relation) return this.relation.inverseEntityMetadata;

		// entityOrProperty is Entity class

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Verify the relation path matches a @*ToOne decorator's property name on the target entity (check entity metadata).
  2. For nested paths, ensure each segment is a real relation: 'user.profile.address' requires profile on user and address on profile.
  3. If you mean a raw column join, use leftJoin(Entity, 'alias', 'alias.col = other.col') instead of the property-path form.
  4. Rebuild after adding the missing @Relation decorator to the entity.

Example fix

// before — 'groupMembers' is not a relation on Team
qb.leftJoin('team.groupMembers', 'gm');

// after — use the real relation name 'members'
qb.leftJoin('team.members', 'm');
Defensive patterns

Strategy: type-guard

Validate before calling

function relationExists(metadata: import('../metadata/EntityMetadata').EntityMetadata, path: string): boolean {
  return !!metadata.findRelationWithPropertyPath(path);
}
const meta = dataSource.getMetadata(Entity);
if (!relationExists(meta, 'someRelation')) throw new Error(`relation 'someRelation' not found on ${meta.targetName}`);

Type guard

function isKnownRelation(metadata: import('../metadata/EntityMetadata').EntityMetadata, path: string): path is string {
  return !!metadata.findRelationWithPropertyPath(path);
}

Prevention

When it happens

Trigger: Calling leftJoin('entity.someRelation', 'alias') where 'someRelation' is not a @Relation decorator on the entity, or is misspelled, or belongs to a different entity than the one aliased. Also when joining through an inheritance child whose relation lives on a sibling class.

Common situations: Renaming a relation property without updating join call sites. Joining a relation defined on a subclass from the base entity alias. Typo in the dot-separated relation path. Using a column name instead of the relation property name.

Related errors


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