{"record":{"id":"3d191ad65c41bd30","repo":"n8n-io/n8n","slug":"relation-with-property-path-this-relationpropert","errorCode":null,"errorMessage":"Relation with property path ${this.relationPropertyPath} in entity was not found.","messagePattern":"Relation with property path (.+?) in entity was not found\\.","errorType":"exception","errorClass":"TypeORMError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/query-builder/JoinAttribute.ts","lineNumber":172,"sourceCode":"\t\t\t\tlet relation = relationOwnerSelection.metadata.findRelationWithPropertyPath(\n\t\t\t\t\tthis.relationPropertyPath!,\n\t\t\t\t);\n\n\t\t\t\tif (relation) {\n\t\t\t\t\treturn relation;\n\t\t\t\t}\n\n\t\t\t\tif (relationOwnerSelection.metadata.parentEntityMetadata) {\n\t\t\t\t\trelation =\n\t\t\t\t\t\trelationOwnerSelection.metadata.parentEntityMetadata.findRelationWithPropertyPath(\n\t\t\t\t\t\t\tthis.relationPropertyPath!,\n\t\t\t\t\t\t);\n\t\t\t\t\tif (relation) {\n\t\t\t\t\t\treturn relation;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthrow new TypeORMError(\n\t\t\t\t\t`Relation with property path ${this.relationPropertyPath} in entity was not found.`,\n\t\t\t\t);\n\t\t\t};\n\t\t\tthis.relationCache = getValue.bind(this)();\n\t\t\tthis.relationEvaluated = true;\n\t\t}\n\t\treturn this.relationCache;\n\t}\n\n\t/**\n\t * Metadata of the joined entity.\n\t * If table without entity was joined, then it will return undefined.\n\t */\n\tget metadata(): EntityMetadata | undefined {\n\t\t// entityOrProperty is relation, e.g. \"post.category\"\n\t\tif (this.relation) return this.relation.inverseEntityMetadata;\n\n\t\t// entityOrProperty is Entity class","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/query-builder/JoinAttribute.ts#L154-L190","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the relation path matches a @*ToOne decorator's property name on the target entity (check entity metadata).","For nested paths, ensure each segment is a real relation: 'user.profile.address' requires profile on user and address on profile.","If you mean a raw column join, use leftJoin(Entity, 'alias', 'alias.col = other.col') instead of the property-path form.","Rebuild after adding the missing @Relation decorator to the entity."],"exampleFix":"// before — 'groupMembers' is not a relation on Team\nqb.leftJoin('team.groupMembers', 'gm');\n\n// after — use the real relation name 'members'\nqb.leftJoin('team.members', 'm');","handlingStrategy":"type-guard","validationCode":"function relationExists(metadata: import('../metadata/EntityMetadata').EntityMetadata, path: string): boolean {\n  return !!metadata.findRelationWithPropertyPath(path);\n}\nconst meta = dataSource.getMetadata(Entity);\nif (!relationExists(meta, 'someRelation')) throw new Error(`relation 'someRelation' not found on ${meta.targetName}`);","typeGuard":"function isKnownRelation(metadata: import('../metadata/EntityMetadata').EntityMetadata, path: string): path is string {\n  return !!metadata.findRelationWithPropertyPath(path);\n}","tryCatchPattern":null,"preventionTips":["Validate relation paths against entity metadata before joining.","Use the relation property name (not the column/inverse name).","Keep relation names stable and update join call sites on rename.","Add a unit test asserting each join path resolves against metadata."],"tags":["query-builder","join","relation","metadata"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}