{"record":{"id":"f3c9ddc0909c5902","repo":"n8n-io/n8n","slug":"property-propertypath-was-not-found-in-met","errorCode":null,"errorMessage":"Property \"${propertyPath}\" was not found in \"${metadata.targetName}\". Make sure your query is correct.","messagePattern":"Property \"(.+?)\" was not found in \"(.+?)\"\\. Make sure your query is correct\\.","errorType":"exception","errorClass":"EntityPropertyNotFoundError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/find-options/FindOptionsUtils.ts","lineNumber":329,"sourceCode":"\t\t\t);\n\n\t\t\t// try to find sub-relations\n\t\t\tlet relationMetadata: EntityMetadata | undefined;\n\t\t\tlet relationName: string | undefined;\n\n\t\t\tif (qb.expressionMap.relationLoadStrategy === 'query') {\n\t\t\t\trelationMetadata = relation.inverseEntityMetadata;\n\t\t\t\trelationName = relationAlias;\n\t\t\t} else {\n\t\t\t\tconst join = qb.expressionMap.joinAttributes.find(\n\t\t\t\t\t(join) => join.entityOrProperty === selection,\n\t\t\t\t);\n\t\t\t\trelationMetadata = join!.metadata!;\n\t\t\t\trelationName = join!.alias.name;\n\t\t\t}\n\n\t\t\tif (!relationName || !relationMetadata) {\n\t\t\t\tthrow new EntityPropertyNotFoundError(relation.propertyPath, metadata);\n\t\t\t}\n\n\t\t\tthis.applyRelationsRecursively(\n\t\t\t\tqb,\n\t\t\t\tallRelations,\n\t\t\t\trelationName,\n\t\t\t\trelationMetadata,\n\t\t\t\tprefix ? prefix + '.' + relation.propertyPath : relation.propertyPath,\n\t\t\t);\n\n\t\t\t// join the eager relations of the found relation\n\t\t\t// Only supported for \"join\" relationLoadStrategy\n\t\t\tif (qb.expressionMap.relationLoadStrategy === 'join') {\n\t\t\t\tconst relMetadata = metadata.relations.find(\n\t\t\t\t\t(metadata) => metadata.propertyName === relation.propertyPath,\n\t\t\t\t);\n\t\t\t\tif (relMetadata) {\n\t\t\t\t\tthis.joinEagerRelations(qb, relationAlias, relMetadata.inverseEntityMetadata);","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/find-options/FindOptionsUtils.ts#L311-L347","documentation":"Inside applyRelationsRecursively, when resolving a nested relation under relationLoadStrategy 'query' or 'join', TypeORM derives the next relationName and relationMetadata. If either is empty (the join/selection couldn't be found in the expression map), it throws EntityPropertyNotFoundError with the original propertyPath and the parent entity targetName. This indicates a relation path whose prefix doesn't correspond to any loaded relation alias.","triggerScenarios":"Requesting `relations: ['profile.address.city']` where `profile.address` is loaded but `city` isn't a relation of Address (it's a column); relationLoadStrategy mismatch (query vs join) where the expected join attribute wasn't created; manually-built query builders where the alias expected by recursive resolution was renamed; selecting a relation path before joining it.","commonSituations":"Deep nested relation paths where a mid-segment is a column not a relation; switching relationLoadStrategy without updating the relations array; custom query builder where aliases don't match what the find-options utility expects; copy-pasting a path from a different entity.","solutions":["Verify each segment of a dotted relation path is a relation; for terminal columns use `select`, not `relations`.","Keep relationLoadStrategy consistent with the query shape (join strategy requires the joins to exist in the expression map).","When using a custom query builder with find-options, ensure aliases match what setFindOptions expects.","Build the relations array incrementally to localize the failing segment."],"exampleFix":"// before\nawait repo.find({ relations: ['profile.address.city'] });\n// `city` is a column on Address, not a relation\n\n// after - relations only for related entities, select for columns\n@Entity()\nclass Profile { @OneToOne(() => Address) address!: Address; }\nclass Address { @Column() city!: string; }\nawait repo.find({ relations: ['profile', 'profile.address'] });","handlingStrategy":"validation","validationCode":"function validateNestedRelations<Entity>(meta: import('@n8n/typeorm').EntityMetadata<Entity>, relations: readonly string[]): void {\n  for (const path of relations) {\n    let m = meta;\n    const segs = path.split('.');\n    segs.forEach((seg, i) => {\n      const rel = m.relations.find(x => x.propertyPath === seg);\n      if (!rel) {\n        const isLast = i === segs.length - 1;\n        if (isLast && m.columns.some(c => c.propertyPath === seg)) {\n          throw new Error(`'${seg}' is a column, not a relation — use select, not relations`);\n        }\n        throw new Error(`relation segment '${seg}' not found on ${m.name}`);\n      }\n      m = rel.inverseEntityMetadata;\n    });\n  }\n}\nvalidateNestedRelations(connection.getMetadata(Entity), options.relations ?? []);\nawait repo.find(options);","typeGuard":"function isTerminalColumn(meta: import('@n8n/typeorm').EntityMetadata<any>, seg: string): boolean {\n  return meta.columns.some(c => c.propertyPath === seg);\n}","tryCatchPattern":null,"preventionTips":["Ensure every segment of a nested relation path is a relation; use select for terminal columns.","Keep relationLoadStrategy consistent with the joins present in the query.","Build nested relations one level at a time to localize failures.","For custom query builders, ensure aliases match what setFindOptions expects."],"tags":["typeorm","find-options","relations","nested","metadata"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}