{"record":{"id":"ef98991bf30ef5f4","repo":"n8n-io/n8n","slug":"property-propertypath-was-not-found-in-met-ef9899","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/query-builder/QueryBuilder.ts","lineNumber":1167,"sourceCode":"\t\t\t\troot.push(...part.split('.'));\n\t\t\t\tpropertyPathParts.shift();\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tif (!alias) {\n\t\t\tthrow new Error(`Cannot find alias for property ${propertyPath}`);\n\t\t}\n\n\t\t// Remaining parts are combined back and used to find the actual property path\n\t\tconst aliasPropertyPath = propertyPathParts.join('.');\n\n\t\tconst columns = alias.metadata.findColumnsWithPropertyPath(aliasPropertyPath);\n\n\t\tif (!columns.length) {\n\t\t\tthrow new EntityPropertyNotFoundError(propertyPath, alias.metadata);\n\t\t}\n\n\t\treturn [alias, root, columns];\n\t}\n\n\t/**\n\t * Creates a property paths for a given ObjectLiteral.\n\t */\n\tprotected createPropertyPath(\n\t\tmetadata: EntityMetadata,\n\t\tentity: ObjectLiteral,\n\t\tprefix: string = '',\n\t) {\n\t\tconst paths: string[] = [];\n\n\t\tfor (const key of Object.keys(entity)) {\n\t\t\tconst path = prefix ? `${prefix}.${key}` : key;\n","sourceCodeStart":1149,"sourceCodeEnd":1185,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/query-builder/QueryBuilder.ts#L1149-L1185","documentation":"Thrown as EntityPropertyNotFoundError when QueryBuilder.normalizePropertyPath resolves an alias but the resolved aliasPropertyPath (the dot-joined remaining parts) does not match any column on that alias's entity metadata via findColumnsWithPropertyPath. It signals a WHERE/ORDER BY/SET clause referenced a property path that the entity does not expose.","triggerScenarios":"Calling qb.where('user.nonExistentField = :val', {val:1}) or qb.orderBy('user.tpyo') where the path is misspelled or refers to a column that was removed/renamed in the entity. Also triggered by referencing embedded/relation paths with wrong separators, or by passing a raw SQL fragment that TypeORM tries to interpret as a property path of the main alias.","commonSituations":"Entity refactor renames a column but query strings keep the old name; copy-pasted query from another entity; accessing a getter that is not a @Column; using camelCase path when the entity uses snake_case propertyPath after a naming-strategy change; leftover references after a migration drops a column.","solutions":["Print metadata.targetName and inspect the actual @Column/@RelationPropertyPath fields of that entity; correct the property string in the query.","If the path is dynamic/user-supplied, validate it against Object.keys(metadata.propertiesMap) before passing it to the builder.","For raw expressions that are not entity properties, wrap them in a literal/bracketed SQL form or use addGroupBy/raw select instead of a property-path API.","Run pnpm typecheck and rebuild the @n8n/db package after entity renames so stale references surface at compile time."],"exampleFix":"// before\nqb.where('user.fullName = :v', { v: name });\n// after (fullName is not a column; use firstName + lastName)\nqb.where('user.firstName = :first', { first: f })\n  .andWhere('user.lastName = :last', { last: l });","handlingStrategy":"validation","validationCode":"import { DataSource } from 'typeorm';\n\nfunction assertPropertyPath(ds: DataSource, target: Function, path: string) {\n  const meta = ds.getMetadata(target);\n  const parts = path.split('.');\n  let props = meta.propertiesMap;\n  for (const p of parts) {\n    if (!(props as Record<string, unknown>)[p])\n      throw new Error(`Unknown property path '${path}' on ${meta.targetName}`);\n  }\n}\n// assertPropertyPath(ds, User, 'user.fullName') before qb.where(...)","typeGuard":"function isValidPropertyPath(value: unknown): value is string {\n  return typeof value === 'string' && /^[A-Za-z_$][\\w$]*(\\.[A-Za-z_$][\\w$]*)*$/.test(value);\n}","tryCatchPattern":null,"preventionTips":["Never hand-build property-path strings from user input; whitelist allowed paths per entity.","After renaming an entity column, run a repo-wide search for the old name in string literals.","Keep query fragments typed: import alias names and column names as constants from the entity module."],"tags":["typeorm","query-builder","entity-metadata","property-path"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}