{"record":{"id":"b1b84a547a7fe892","repo":"n8n-io/n8n","slug":"cannot-find-alias-for-property-propertypath","errorCode":null,"errorMessage":"Cannot find alias for property ${propertyPath}","messagePattern":"Cannot find alias for property (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/query-builder/QueryBuilder.ts","lineNumber":1158,"sourceCode":"\t\t\t\t\t(joinAttr) => joinAttr.relationPropertyPath === part,\n\t\t\t\t);\n\n\t\t\t\tif (!joinAttr?.alias) {\n\t\t\t\t\tconst fullRelationPath = root.length > 0 ? `${root.join('.')}.${part}` : part;\n\t\t\t\t\tthrow new Error(`Cannot find alias for relation at ${fullRelationPath}`);\n\t\t\t\t}\n\n\t\t\t\talias = joinAttr.alias;\n\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(","sourceCodeStart":1140,"sourceCodeEnd":1176,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/query-builder/QueryBuilder.ts#L1140-L1176","documentation":"QueryBuilder property-path resolver throws when, after exhausting the path segments, no alias is found at all for the given propertyPath. Unlike 1078 (relation exists but not joined), this fires when the root alias itself or an intermediate alias cannot be resolved — the path does not map to any alias/metadata pair in the query. It is followed by an EntityPropertyNotFoundError check if an alias is found but columns are missing.","triggerScenarios":"Calling .where('unknownAlias.col = :v'), .orderBy('col') with no main alias, or referencing a property path whose root alias was never created. Also when the alias name has a typo or uses a different case than the one registered.","commonSituations":"Typo in the alias prefix. Using a column-only path ('col') without a main alias. Copying a where clause from another query with different aliases. Case-sensitivity mistakes on alias names.","solutions":["Verify the alias prefix in the property path matches a registered alias (the main alias from from/select, or a join alias).","Prefix property paths with the correct alias: 'u.email' not 'email' when using a non-default alias.","Ensure createQueryBuilder(Entity, 'u') sets the alias you reference.","Add the missing join that introduces the alias."],"exampleFix":"// before\nconst qb = dataSource.createQueryBuilder(User, 'u')\n  .andWhere('users.email = :e', { e }); // 'users' alias not registered\n\n// after\nconst qb = dataSource.createQueryBuilder(User, 'u')\n  .andWhere('u.email = :e', { e });","handlingStrategy":"validation","validationCode":"function aliasExists(qb: { expressionMap: { aliases: Array<{ name: string }>; mainAlias?: { name: string } } }, name: string): boolean {\n  const aliases = [...qb.expressionMap.aliases.map(a => a.name), ...(qb.expressionMap.mainAlias ? [qb.expressionMap.mainAlias.name] : [])];\n  return aliases.includes(name);\n}\nif (!aliasExists(qb, aliasName)) throw new Error(`alias '${aliasName}' is not registered; check from/select/join aliases`);","typeGuard":"function aliasIsRegistered(qb: { expressionMap: { aliases: Array<{ name: string }>; mainAlias?: { name: string } } }, name: string): boolean {\n  const names = new Set([...qb.expressionMap.aliases.map(a => a.name), qb.expressionMap.mainAlias?.name].filter(Boolean) as string[]);\n  return names.has(name);\n}","tryCatchPattern":null,"preventionTips":["Prefix property paths with a registered alias (the from/select alias or a join alias).","Verify alias spelling and case against the builder's aliases.","Ensure createQueryBuilder(Entity, 'alias') sets the alias you reference.","Add the missing join that introduces the alias before referencing its columns."],"tags":["query-builder","alias","property-path","where"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}